[comp.sys.mac] Funny behaviour while using MS FOTRAN v2.2

remym@tekig5.UUCP (02/04/87)

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 <CR> 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 ---------