optimisation -O1 changes floating-point results
Florian Weimer
fweimer@redhat.com
Wed Dec 18 15:03:00 GMT 2013
On 12/18/2013 03:23 PM, Diggory Hardy wrote:
> Is this a known issue?
Yes, it's the excess precision problem on i386:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323
> Is it the same with later GCC versions?
GCC 4.5 has some fixes.
> Is there a way I can turn on most optimisations while still getting exactly
> the same results as without optimisation?
You could compile with -mfpmath=sse -msse2, or you could set the
floating point control word to restrict precision to 53 bits. The
latter will cover doubles only, the issue can still surface with floats.
--
Florian Weimer / Red Hat Product Security Team
More information about the Gcc-help
mailing list