This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: turning off optimization on a code segment
- From: Andrew Haley <aph at redhat dot com>
- To: Frédéric BOIS <Frederic dot BOIS at ineris dot fr>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 23 May 2008 16:30:30 +0100
- Subject: Re: turning off optimization on a code segment
- References: <4836FC26.9751.004E.0@ineris.fr>
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.