consider the following code snippet -------- nan.cc ------- #include <iostream> int main() { double x = 0.55555555555555558023; std::cout << x << " "; std::cout << x << " "; std::cout << std::endl; return 0; } -------- nan.cc ------- > g++-4.0-20041226 -v Using built-in specs. Configured with: ../gcc-4.0-20041226/configure --prefix=/opt/gcc-4.0-20041226 --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-nls --program-suffix=-4.0-20041226 --with-arch=pentium3 --disable-checking Thread model: posix gcc version 4.0.0 20041226 (experimental) > g++-4.0-20041226 nan.cc > ldd a.out libstdc++.so.6 => /opt/gcc-4.0-20041226/lib/libstdc++.so.6 (0x40017000) libm.so.6 => /lib/libm.so.6 (0x400fc000) libgcc_s.so.1 => /opt/gcc-4.0-20041226/lib/libgcc_s.so.1 (0x4011f000) libc.so.6 => /lib/libc.so.6 (0x40129000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) > ./a.out 0.555556 nan well this nan shouldn't be there > g++-4.0-20041226 nan.cc -static > ./a.out 0.555556 0.555556 > g++-4.0-20041212 -v Reading specs from /opt/gcc-4.0-20041212/lib/gcc/i686-pc-linux-gnu/4.0.0/specs Configured with: ../gcc-4.0-20041212/configure --prefix=/opt/gcc-4.0-20041212 --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-nls --program-suffix=-4.0-20041212 --with-arch=pentium3 --disable-checking Thread model: posix gcc version 4.0.0 20041212 (experimental) > g++-4.0-20041212 nan.cc > ldd ./a.out libstdc++.so.6 => /opt/gcc-4.0-20041212/lib/libstdc++.so.6 (0x40017000) libm.so.6 => /lib/libm.so.6 (0x400fb000) libgcc_s.so.1 => /opt/gcc-4.0-20041212/lib/libgcc_s.so.1 (0x4011e000) libc.so.6 => /lib/libc.so.6 (0x40128000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) > ./a.out 0.555556 0.555556 g++-4.0-20041212 doesn't have this problem
I cannot reproduce this on powerpc-darwin.
Oh i forgot my system triplets, they are all i686-pc-linux-gnu g++-4.0-20041226 -v doesn't show the triplet any more, there is only a line Using built-in specs. i suggest to remove this new feature for convenience.
it looks like it is really a library problem. Using the libraries from gcc-4.0-20041212 everything is fine, although nan.cc was nevertheless compiled with gcc-4.0-20041226. > ldd a.out libstdc++.so.6 => /opt/gcc-4.0-20041212/lib/libstdc++.so.6 (0x40017000) libm.so.6 => /lib/libm.so.6 (0x400fb000) libgcc_s.so.1 => /opt/gcc-4.0-20041212/lib/libgcc_s.so.1 (0x4011e000) libc.so.6 => /lib/libc.so.6 (0x40128000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) > ./a.out 0.555556 0.555556
I don't reproduce this with a build from last night. Try again with today's sources. In particular, the symptom looks as if the fpu has been put into mmx mode. Which might be solved with 2004-12-27 Richard Henderson <rth@redhat.com> * config/i386/i386.h (UNITS_PER_SIMD_WORD): Don't use MMX/3DNOW. 2004-12-26 Richard Henderson <rth@redhat.com> * config/i386/i386.md (mov<MMXMODEI>_internal_rex64): New. (movv2sf_internal_rex64): New. (mov<MMXMODEI>_internal): Use no register preferences at all. (movv2sf_internal): Likewise.
Sorry no cvs available, and only a modem dial-up connection, i'll try it when the new snapshot diff is available.
if i remove the architecture option from the configure parameters > g++-4.0-20041226-na -v Using built-in specs. Configured with: ../gcc-4.0-20041226/configure --prefix=/opt/gcc-4.0-20041226-na--enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-nls --program-suffix=-4.0-20041226-na --disable-checking Thread model: posix gcc version 4.0.0 20041226 (experimental) > g++-4.0-20041226-na nan.cc > ./a.out 0.555556 0.555556 > g++-4.0-20041226-na nan.cc -march=pentium3 > ./a.out 0.555556 0.555556 is this mysterious? because now everything looks o.k. for compilation of gcc-4.0-20041226 i used gcc-4.0-20041212.
well i've tested gcc-4.0-20050102, (compiled with gcc-4.0-20041212) > g++-4.0-20050102 -v Using built-in specs. Configured with: ../gcc-4.0-20050102/configure --prefix=/opt/gcc-4.0-20050102 --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-nls --program-suffix=-4.0-20050102 --with-arch=pentium3 --disable-checking Thread model: posix gcc version 4.0.0 20050102 (experimental) > g++-4.0-20050102 nan.cc > ./a.out 0.555556 nan the problem is still there
the C-version works with every compiler ------------ nan.c ----------- #include <stdio.h> int main() { double x = 0.55555555555555558023; printf( "%f ", x ); printf( "%f ", x ); printf( "\n" ); return 0; } ------------ nan.c -----------
I'm willing to lay money this is the same problem as PR 19235. *** This bug has been marked as a duplicate of 19235 ***
tried gcc-4.0-20050102 with the patch http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&r1=1.597&r2=1.598 from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19235 and the problem still does occur :-( P.S.: compiled with gcc-4.0-20041212
tried gcc-4.0-20050109 compile with gcc-3.4.3 the problem still appears
gcc-4.0-20050116 compiled with gcc-3.3.5 this time with the configure parameter: --with-arch=pentium3 fails withOUT the configure parameter: --with-arch=pentium3 everything is o.k. with respect to the library things i mentionend, is it possible that libstdc++.so is miscompiled, when the above configure parameter is used.?
Yes, it's certainly possible. But indeed pr19511 shows that you can't even get that far with --with-arch=pentium3 at the moment, due to changes that post-date this report. After I get a fix for that problem, will you please re-test? Hopefully I'll have magically fixed this problem which was never sufficiently isolated...
It looks like it is fixed now Compiling gcc-4.0-20050123 with a gcc-4.0-20050116, which has the architecture option disabled, works. Great! Regards Andre
Fixed so lets close it.