Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

What fine-grained options does -O2 stand for?

hypercott
Beginner
266 Views
Hi,

I am running into a problem (with icc,icpc,ifort 11) in which -O1 yields code that produces results that are "correct" while -O2 makes code that produces results that are "incorrect". I would like to incrementally add optimization options, stepping between -O1 and -O2 to see what precisely breaks the code (and then fix the code / submit a bug report). I have been unable to find an exact list of fine-grained optimization options -O2 is an alias for. Can anybody point me to such a list so that I can debug my problem?

Thanks!

- Christian

0 Kudos
3 Replies
mecej4
Honored Contributor III
266 Views
The -list option, if available in your versions of the compilers, will give a detailed list of the options in effect.

However, I think that with source code of nontrivial size this approach will not do much for you. In particular, if there are array overruns or uninitialized variables, the interactions of those bugs with optimization options can be very unpredictable and elusive.
0 Kudos
TimP
Honored Contributor III
266 Views
You may wish to try options such as -fp-model source or its components, if you haven't done so, to see whether those transformations are breaking your code. -fimf-arch-consistency=true is available in 12.0.4, but you could turn off vector math functions by -no-fast-transcendentals in 11.x. Also, the -x options have more effect at -O2 than at -O1.
0 Kudos
jimdempseyatthecove
Honored Contributor III
266 Views
Before you assume a compiler error please enable all the runtime checks.

jim
0 Kudos
Reply