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: Controlling the compile within the compiled file?



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


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