Created attachment 359182 [details]
Description of problem:
gcc on i386 produces numerically inaccurate code as demonstrated
program "paranoia" from netlib (http://www.netlib.org/paranoia/)
Version-Release number of selected component (if applicable):
gcc version 4.4.1 20090725 (Red Hat 4.4.1-2) (GCC)
Steps to Reproduce:
1. get paranoia.c
2. compile: gcc -O2 -o paranoia paranoia.c -lm
3. Run resulting program (./paranoia)
The log is attached. The summary:
The number of FAILUREs encountered = 4.
The number of SERIOUS DEFECTs discovered = 4.
The number of DEFECTs discovered = 3.
The number of FLAWs discovered = 2.
If I compile without optimization, the number of problems become two
The number of DEFECTs discovered = 1.
The number of FLAWs discovered = 1.
No FAILUREs, SERIOUS DEFECTs, or FLAWs
The test passes with flying colors on x86_64 platform.
That's a user error. If you want numerically stable results on i?86, you need either -msse2 -mfpmath=sse, or at least -ffloat-store. Otherwise some operations are computed in higher precision than their types.
OK, it is fair. Both of these switches do reduce number of
problems, but not to 0 though.