Inconsistent floating point result when using G++ 3.3.6 with option -O0 or -O1 separately

Deng Shi Deng.Shi@synopsys.com
Mon Jul 17 00:45:00 GMT 2006


Hi Tprince,
We do build on IA-32 system and running on the same system, but we still get the inconsistent result as I described in the previous mail.  We have added the control function to remove the excess precision in main faction like 

     fpu_control_t cw = (_FPU_DEFAULT & ~_FPU_EXTENDED) | _FPU_DOUBLE;
    _FPU_SETCW(cw);

Can you help to give some suggestions about which possibility may cause the inconsistent result within -O0 or -O1 optimization separately?

I will try the -ffloat-store option.

Best regards!
Deng

-----Original Message-----
From: Tim Prince [mailto:timothyprince@sbcglobal.net] 
Sent: 2006年7月14日 20:28
To: Deng Shi
Cc: gcc-help@gcc.gnu.org
Subject: Re: Inconsistent floating point result when using G++ 3.3.6 with option -O0 or -O1 separately

Deng Shi wrote:
>  
> 
> -----Original Message-----
> From: Deng Shi
> Sent: 2006年7月13日 10:37
> To: 'gnu-help@gnu.org'
> Subject: Inconsistent floating point result when using G++ 3.3.6 with 
> option -O0 or -O1 separately
> 
> hi expert,
> I found our application tool gave the inconsistent floating point result when using different optimization level -O0 or -O1.
> Even if I used -O1 plus all the disabling options which includes in -O1, like -O1 -fno-merge-all-constants -fno-zero-initialized-in-bss -fno-function-cse -fno-keep-static-consts -fno-omit-frame-pointer -fno-merge-constants -fno-loop-optimize -fno-cprop-registers -fno-if-conversion -fno-if-conversion2 -fno-delayed-branch -fno-guess-branch-probability -fno-defer-pop -fno-crossjumping -fno-thread-jumps " which command line setting should be equal to -O0, but I still didn't get the consistent result. 
> I wonder whether there is any additional optimization enabled by -O1 for C++ language which is not documented in GCC manual?
> 
If you're generating x87 code (the default for ia32), -ffloat-store would be among the first options normally tried to remove extra precision.  How are we to know what target you have, and which options you used?



More information about the Gcc-help mailing list