This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/6914: -O2 and -O give different results for the same valid FP code
- From: "Michael Veksler" <VEKSLER at il dot ibm dot com>
- To: tprince at computer dot org
- Cc: gcc-gnats at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org
- Date: Mon, 3 Jun 2002 18:49:24 +0300
- Subject: Re: c++/6914: -O2 and -O give different results for the same valid FP code
- Sensitivity:
Tim Prince wrote:
+ Among the remedies available would be
+ a) set 53-bit rounding mode
+ b) choose -msse2, for appropriate targets
After rereading the gcc manual, I found "-ffloat-store" which is the best remedy. It is described in:
http://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Optimize-Options.html#Optimize%20Options
It says "For most programs, the excess precision does only good". This statement is wrong. It is unbearable to have a perfectly valid
code behave differently with -O2 and -O0 on the same platform. The default
should be changed to -ffloat-store. Of course, when passing -funsafe-math-optimizations, gcc may also set -fno-float-store.
If the decision will be to keep the current behavior, documentation should
be updated. It should be more clear that -float-store is critical for IEEE
conformance on targets like x86. Also, the bugs section should contain
this as a known bug (and bug it is -- gcc does not conform to the IEEE
standard on x86).