disable gcc optimization of some parts of code...

Tom St Denis tstdenis@ellipticsemi.com
Wed Oct 17 12:02:00 GMT 2007


jonatan perry wrote:
> Hi,
> I have some arithmetic calculation  that the GCC optimizer  optimize
> (e.g. a=8+8 become a=16....). who can I disable it from doing that on
> some of the parts in the code? something like MACRO commands.... if
> you have any other ideal I'll be happy to hear...
>   

Factor your code so that the part you don't want optimized appears in 
it's own unit (e.g. .o file) and build makefile that turns off 
optimization for that object.

Alternatively, and probably more appropriate, just debug why the 
optimizer is causing problems and fix the bug in your code (or report a 
gcc bug).

Tom



More information about the Gcc-help mailing list