turning off optimization on a code segment
Andrew Haley
aph@redhat.com
Fri May 23 16:08:00 GMT 2008
Frédéric BOIS wrote:
> Hi!
>
> I have a problem with a code segment (actually one line). If I compile
> with no optimization (with or without debugging enabled) it's fine.
> If I optimize (again with or without debugging) it fails for one
> mis-computed line:
> pifn->bOn = (*pdTime < *pdTnext);
> if *pdTime is equal to *pdTnext (checked in gdb: print *pdTime -
> *pdTnext returns zero and print (*pdTime < *pdTnext) returns 0 too)
> the computed value of pifn->bOn is "1", and that's an error. I don't
> know exactly what to do and I am in a rush. I could try to go around
> all that, but an easy quick fix might be to turn off the optimization
> of the routine. However, I don't know how to do that.
> I get that with gcc 3.3.3 (suze linux), and on v 4.3.0 under debian
> linux.
Don't use "gcc -O". I know you probably want to de-optimize just one
function, but you can't do that.
However, I'd try to find the real bug.
Andrew.
More information about the Gcc-help
mailing list