Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!mit-eddie!genrad!decvax!tektronix!tekig!tekig5!remym From: remym@tekig5.UUCP Newsgroups: comp.sys.mac Subject: Funny behaviour while using MS FOTRAN v2.2 Message-ID: <1398@tekig5.TEK.COM> Date: Wed, 4-Feb-87 13:33:54 EST Article-I.D.: tekig5.1398 Posted: Wed Feb 4 13:33:54 1987 Date-Received: Sat, 7-Feb-87 09:49:26 EST Organization: Tektronix Inc., Beaverton, Or. Lines: 74 Keywords: WARNING: contains FORTRAN code! :-) I have noticed something strange regarding MS FORTRAN's (v2.2) handling of REAL*8 FUNCTIONS. i.e. The compiler *seems* to generate bad code from my examination of the assembly listings of the program. I have included a sample pgm. to test the real*8 function call. I have yet to make this call work w/ MS FORTRAN although I did verify the code worked on another computer. (In fact, the original code that I was working on was tested on two other computers and found to be right on both of those. Only on the Mac did I have problems.) If some kind soul could verify my results or, better, tell me what I did wrong w.r.t. the MS compiler, I would appreciate an e-mail reply. If you do verify this strange behaviour and would like to talk to MS, their product support number is: (206)-882-8089. Yours truly, A. Remy Malan ph: (503)-627-4184 ---------------------------------------------------- Here is the code (assembly fragment follows source): C C TEST PROGRAM FOR STRANGE BEHAVIOUR IN C MS FORTRAN V2.2 C WRITTEN BY A. REMY MALAN 2/4/87 C PROGRAM TEST REAL*8 SUM C C USE THE ASSEMBLY LISTING OPTION TO EXAMINE THE ASM C CODE FOR THE NEXT FORTRAN LINE. I SAW A "JSR 140(A4)" C WHICH IS CONVERT SINGLE TO DOUBLE! THAT C MAKES IT SEEM THAT THE COMPILER THINKS THAT FOOB() C IS A REAL*4 WHEN IN FACT IT IS DECLARED AS REAL*8! C SUM = FOOB() C C PRINT *, 'TEST: SUM = ',SUM PRINT *, 'HIT TO QUIT...' PAUSE STOP END REAL*8 FUNCTION FOOB() REAL*8 P P = 25.0D+00 PRINT *, 'FOOB: P = ',P FOOB=P RETURN END --------- end of FORTRAN --------- Here is the assembler listing for the "sum=foob()" line: Note the "jsr 140(a4)" line! This, according to the manual, is an intrinsic function call, CVTFL. ; SUM = FOOB() MOVE.L #.FOOB-L00003,D1 L00003: JSR L00003(PC,D1.L) MOVEA.L A7,A3 JSR 140(A4) ;This is convert single to double! - ARM MOVEM.L D0/D1,(A3) --------- end of ASM fragment ---------