This is the mail archive of the gcc@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]

Re: egcs-1.0.2 i686-pc-linux-gnu math optimization pb


	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


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