Package: gcc-4.3 Version: 4.3.0-1 Severity: normal --- Please enter the report below this line. ---
Hi, the following code: $ cat quot.c #include <stdio.h> int main() { double a = -4.1974624032366689e+117; double b = -8.4657370748010221e-47; double c = a/b; printf("%.16e\n%.16e\n%.16e\n",a, b, c); return 0; } when compiled: $ gcc -W -Wall quot.c and run without -O: $ ./a.out -4.1974624032366689e+117 -8.4657370748010221e-47 4.9581771393902231e+163 and with -O: $ gcc -W -Wall -O quot.c $ ./a.out -4.1974624032366689e+117 -8.4657370748010221e-47 4.9581771393902237e+163 produces different results in the last digit. The "-O" case is correct. That is because the -O option uses MPFR to calculate the (correct) result at compile time, as can be checked in the assembly. This only happens on 32 bits (intel core 2 duo), it doesn't happen when using Debian amd64 (gcc produces a different, correct, assembly there). A lot more information, together with how this was discovered can be found here: http://code.google.com/p/mpmath/issues/detail?id=22 you can also find the assembly codes in there. Note, that MSVC produces the correct 32 bit assembly, see the issue, that's why I think the problem is not in my processor, but rather in gcc. I tried gcc-3.4, gcc-4.1, gcc-4.2, gcc-4.3 and gcc-snapshot. No difference. However, I am not an expert in this at all - maybe I did something wrong. Please ask if you need more information. I'd like to trace this bug down and figure out if it's a bug in gcc, or somewhere else. Ondrej --- System information. --- Architecture: i386 Kernel: Linux 2.6.24-1-686 Debian Release: lenny/sid 500 unstable ftp.cz.debian.org --- Package information. --- Depends (Version) | Installed =====================================-+-===================== binutils (>= 2.17cvs20070426) | 2.18.1~cvs20080103-1 cpp-4.3 (= 4.3.0-1) | 4.3.0-1 gcc-4.3-base (= 4.3.0-1) | 4.3.0-1 libc6 (>= 2.7-1) | 2.7-9 libgcc1 (>= 1:4.3.0-1) | 1:4.3.0-1 libgomp1 (>= 4.3.0-1) | 4.3.0-1 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]