Regarding -fno optimization options

Parang Saraf
Wed Jul 25 06:35:00 GMT 2012


I have few very basic questions:

1. I want to turn-on only some of the optimization flags for O1. Is
doing this enough?:

      " gcc -O0 -fcprop-registers -fdefer-pop -fif-conversion [...] -o
program program.c "

    I tried with a bunch of options, generated an assembly file and
compared the assembly file with the assembly generated from just -O0.
Ideally, there should be a difference. Right?

2. Secondly, if I can switch-on flags like this, then what is the need
for -fno optimization options? Are -fno options meant just to reduce
the number of command line options, ie. say if for O1 I want most of
the flags except a few, then I can do "-O1 -fno-flag" ? If that's the
case, then why not all the flags have a -fno switch.

3. In the gcc 4.7.1 optimization options documentation, there is a line:

     " Most optimizations are only enabled if an -O level is set on
the command line. Otherwise they are disabled, even if individual
optimization flags are specified. "

    What exactly is the meaning of second line?

Thanks and Regards

More information about the Gcc-help mailing list