This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: egcs-1.0.2 i686-pc-linux-gnu math optimization pb
- To: Neal Becker <neal at ctd dot comsat dot com>
- Subject: Re: egcs-1.0.2 i686-pc-linux-gnu math optimization pb
- From: Jim Wilson <wilson at cygnus dot com>
- Date: Wed, 08 Apr 1998 17:12:05 -0700
- cc: egcs at cygnus dot com
I have some c++ code that produces incorrect results when compiled
with -O2 or -O3 (but not -O). It is floating-point math. Have cases
like this been reported before?
Yes. On the x86, registers have more (excess) precision than memory, which
means the exact result you get depends on whether a value is in a register
or in memory. Changing the optimization options changes register allocation,
which changes which values are in memory, and hence can change the program
result.
Use of -ffloat-store solves some problems. Writing code less sensitive to
excess precision problems solves others. Rewriting parts of the gcc x86 port
might fix others. Hopefully IA64 (Merced) won't have this problem.
Jim