This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: turning off optimization on a code segment


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.


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