Andrew Haley wrote:
Vladimir Simonov writes:
>
> Andrew Haley wrote:
> > Wei Hu writes:
> > > Hello,
> > >
> > > Is there a way to tell gcc to print out all the effective optimization
> > > flags when it compiles a C file?
> > > I know the manual tells you what flags are set at different
> > > optimization levels, but I'm still looking for an answer to my
> > > question because it will be useful to my project.
> >
> > Yes. -fverbose-asm dumps the flags to the .s file.
>
> Sorry, if probably a bit offtopic from subj.
>
> I've created flags lists for -O0 and -O2,
> made diff (see attach) and built my project
> both with -O0 and -O2 -fno-{all options marked by + in diff}.
>
> I've expected that results(binaries) will be equal.
> But they are different.
>
> Are my expectations correct?
> Or -O0 and -O2 -fno-{all options marked
> by + in diff} are not the same?
I don't really understand your question, but if you're asking "if I
set all individual optimization flags but don't set -O, will that
still optimize?" the answer is no. If you're asking "f I unset all
individual optimization flags but set -O2, will that be the same as
-O0", the answer is no.
Andrew.
The second one.
Do you know a way to turn on optimization
flags step by step from -O0 till -O2?
Thank you.
Vladimir