This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/15397] [g77] c float function called from fortran gives wrong result
- From: "gnu at the-meissners dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jul 2005 19:22:06 -0000
- Subject: [Bug target/15397] [g77] c float function called from fortran gives wrong result
- References: <20040512145606.15397.harald.vogt@desy.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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