views:

150

answers:

3

I seem to remember being able to print out (or locate) the specific switches that each -O<num> option turns on. Can you remind?

Thanks!

+2  A: 

You may also try the good ol' manual

$ man gcc

at the subsection "Options That Control Optimization".

Federico Ramponi
+3  A: 

The list of new features on gcc 4.3 shows a way to do it, via an extension to the --help command line option:

gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
diff /tmp/O2-opts /tmp/O3-opts | grep enabled

Note, however that I never tried that, only read about it. The documentation about this command line option is at http://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html#Overall-Options

If you ever read the list of new features on gcc 4.3, perhaps this was what you were recalling.

CesarB
This is what I was looking for. Thanks!
SetJmp
A: 

On many machines, 'info gcc' will produce a wealth of information. Using 'gcc -v --help' produced a very long listing of options from sub-processes (actually, 1001 lines on stdout, and 14 on stderr) on my Mac (PPC G4 and MacOS X 10.4.11).

Jonathan Leffler