Controlling the compile within the compiled file?

Ciaran O'Riordan ciaran_o_riordan@hotmail.com
Thu Sep 26 20:19:00 GMT 2002


>From: "Shuki Sasson" <shuki_sasson@hotmail.com>
>
>Hi all, I came across a problem with the optimizer (-O option) the -O0 
>option get rid of the problem.

what is the problem with the optimizer?

>A question:
>Can one instruct the gcc compiler to turn option on/off within the compiled 
>code?

No.  Optimisation is a one-way function.

If you have an expression in your code "(1 + 1)" the optimiser will
replace this with "2".  The compiled program does not know that the
programmer typed "(1 + 1)".  I know your talking about more complex
code but the principle is the same.

You'll have to recompile if you want to change the optimisations.
If the problem occurs when you use "gcc -O", try -O2, -O3 or -Os.
If the problem doesn't go away try specifying the optimisation
switches yourself i.e. gcc -fforce-mem -fomit-frame-pointer (etc.)

Hope this helps

Ciaran O'Riordan

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com



More information about the Gcc-help mailing list