This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Irix6 long doubles implemented wrong? (27_io/ostream_inserter_arith)
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: gcc-bugs at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Cc: libstdc++ at gcc dot gnu dot org, oldham at codesourcery dot com, ro at TechFak dot Uni-Bielefeld dot DE
- Date: Sat, 14 Dec 2002 16:45:27 -0500 (EST)
- Subject: Irix6 long doubles implemented wrong? (27_io/ostream_inserter_arith)
I'm getting wierd (i.e. I think wrong) results for long doubles on
mips-irix6. Consider the following C testcase:
#include <stdio.h>
int main()
{
char buf[1024];
long double ldin[] = { 1.0L, 1.0L, 1.0L };
long double ldout[3];
fprintf (stdout, "sizeof(long double) == %d\n", (int) sizeof ldin[0]);
sprintf (buf, "%Lf %Lf %Lf", ldin[0], ldin[1], ldin[2]);
sscanf (buf, "%Lf %Lf %Lf", &ldout[0], &ldout[1], &ldout[2]);
fprintf (stdout, "<%Lf><%Lf><%Lf>\n", ldout[0], ldout[1], ldout[2]);
return 0;
}
Compiling and then running this program with "cc -n32" or "cc -64" on
irix6.2 or irix6.5 (correctly I believe for these ABIs) yields:
> sizeof(long double) == 16
> <1.000000><1.000000><1.000000>
Compiling and then running this program with "gcc -mabi=n32" or
"gcc -mabi=64" on irix6.2 or irix6.5 (erroneously) yields:
> sizeof(long double) == 8
> <1.000000><0.000000><-nan0xffffffff>
> Bus error (core dumped)
This appears to occur for all gcc versions from 2.8.1 through the
current CVS trunk.
As you can see, gcc's sizeof (long double) doesn't agree with that
from the system compiler and I would assume therefore that gcc also
disagrees with libc's notion of long double. This means that the %Lf
specifier is hosed and cannot be used from gcc on irix6.
I believe this is the cause of the 27_io/ostream_inserter_arith.cc
failures we've been getting on irix6.
See also http://gcc.gnu.org/ml/gcc-bugs/2001-08/msg00088.html which
apears to be the same issue.
Does anyone have any thoughts on this? (Or better yet a fix?)
Thanks,
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu