question about knowing when optimization options are used

Jonathan Wakely
Thu Mar 19 14:17:43 GMT 2020

On Mon, 16 Mar 2020 at 23:35, Segher Boessenkool wrote:
> On Mon, Mar 16, 2020 at 11:14:25PM +0000, Shrader, David Lee via Gcc-help wrote:
> > 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.
> Yes.
> > The man page says to use `-Q --help=optimizers` to find out what is turned on for the different -O levels as configure-time options can make things different from the defaults shown later in that man page. However, I have found that, even when using -O0, I can turn on optimization options, at least according to the help output:
> You can enable the *flags*, sure, but with -O0 those flags do not do
> anything.  Exactly as the text above says?  The "even if" part.

See also

More information about the Gcc-help mailing list