O2 optimization differences

Dale Johannesen dalej@apple.com
Wed Sep 29 18:44:00 GMT 2004


On Sep 29, 2004, at 9:14 AM, Joe Buck wrote:

> On Wed, Sep 29, 2004 at 03:10:12PM +0530, Sujith R. wrote:
>
>> 	I am finding the output differences between O2 flagged , optimized
>> version and a -g3 -gdwarf-2 flagged debugable version of a C++
>> application , which does some very heavy , floating point , number
>> crunching.  The differences are with very small numbers (close to 0)
>> like 1.234E-11 being treated as 0, but some subsequent calculations go
>> for a toss.
>
> If you're running x86 hardware, you can see things like this.  The
> floating point registers have extra precision (80 bits worth), but this
> precision is lost when a register is spilled to memory.  Since this
> differs depending on optimization level, you will see effects like 
> this.

Indeed.  If this is the problem -ffloat-store may help.



More information about the Gcc mailing list