[Bug target/15397] [g77] c float function called from fortran gives wrong result

gnu at the-meissners dot org gcc-bugzilla@gcc.gnu.org
Wed Jul 6 19:22:00 GMT 2005


------- Additional Comments From gnu at the-meissners dot org  2005-07-06 19:22 -------
FWIW, I tried this with the 4.0 compiler on an AMD64 system, and it doesn't fail
with gfortran.

I did bring over the 3.4.4 release, and tried it with g77, and it failed as
reported.  It passed if I used -m32 with the traditional x86 calling sequence.

If I link the 3.4.4 fortran object with the 4.0.0 C object, it fails.  If I link
the 4.0.0 fortran with the 3.4.4 C object, it passes.

Looking at the code for -O1, between 3.4.4 and 4.0.0, I see, the 4.0.0 generates:
	call	funct2_
	movss	%xmm0, 12(%rsp)

and the 3.4.4 fortran generates:
	call	funct2_
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, 16(%rsp)

Ie, g77 is expecting float values to be returned as a double, and then doing the
conversion.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397



More information about the Gcc-bugs mailing list