This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/6914: -O2 and -O give different results for the same valid FP code


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).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]