This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
ABI mismatch for single precision floating point return between C and Fortran
- From: Gerhard Tonn <GerhardTonn at swol dot de>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 15 Mar 2002 17:58:02 +0100
- Subject: ABI mismatch for single precision floating point return between C and Fortran
Hi,
when I compile and link the following two small programs on the S/390
architecture, I get a wrong result from the C function. This is caused by the
fact that according to the ABI on S/390 a float is returned as single
precision float, but Fortran expects that it is returned as double (that is
what the assembler says).
Does anyone know, if this is somehow tied to Fortran or if I can change this
behaviour by any backend switches. The problem occurs with 2.95.4, 3.0.4 and
the latest 3.1 snapshot.
Btw, the same problem seems to appear on sparc.
Thanks in advance
Gerhard
PROGRAM TST
* .. Parameters ..
INTEGER NOUT
PARAMETER (NOUT=6)
REAL EC
* .. External Subroutines ..
EXTERNAL SDOTTESTC
EC=SDOTTESTC()
WRITE (NOUT,99997) EC
RETURN
99997 FORMAT(2E12.4)
END
float
sdottestc_()
{
float e = 1.34;
printf("%e\n", e);
return e;
}