This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
C version of single precision complex problem
- To: "'egcs-bugs at egcs dot cygnus dot com'" <egcs-bugs at egcs dot cygnus dot com>
- Subject: C version of single precision complex problem
- From: "Billinghurst, David (RTD)" <David dot Billinghurst at riotinto dot com dot au>
- Date: Tue, 27 Jul 1999 06:03:24 -0000
This is a C example to complement the Fortran example in the thread "single
precision complex bug in g77 - was Testing g77 with LAPACK 3.0"
####################################################################
/*
* complex6.c
*
* On 64 bit machines gcc tries to store real and imaginary parts
* of 32 bit floats in one register.
* Under Irix6.5, we get:
* egcs-1.1.2 realpart(2.0+1.0fi) = 0.0
* egcs-2.95 (after 19990715) Compile time error
*
* David Billinghurst (David.Billinghurst@riotinto.com.au
* 27 July 1999
*/
float
realpart( __complex__ float c)
{
return __real__ c;
}
int
main(int argc, char *argv[])
{
float ra = 2.0, rb = 1.0;
__complex__ float a = ra + rb*1.0fi;
float b = realpart(a);
if ( b != ra )
abort();
return (0);
}