This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: binary compiled with -O1 and w/ individual optimization flags are not the same
- From: Eljay Love-Jensen <eljay at adobe dot com>
- To: CSights <csights at fastmail dot fm>, GCC-help <gcc-help at gcc dot gnu dot org>
- Date: Fri, 29 Feb 2008 11:27:23 -0600
- Subject: Re: binary compiled with -O1 and w/ individual optimization flags are not the same
Hi CSights,
> Is there a way to have g++ tell me which flags it is actually using when
> compiling a program. E.g. expand -O1 to the individual optimization flags at
> run time?
Yes.
I use this trick:
g++ -O1 -S -fverbose-asm -x c++ <(echo '') -o O1.s
cat O1.s
> Anyone have any other suggestions?
Keep in mind that -O1 or higher turns on many more "behind the scenes"
optimizations than just those that are twiddle-able with the -f optimization
flags.
And keep in mind that -O0 disables all optimizations, irregardless of
specified -f optimization flags (which are ignored).
HTH,
--Eljay