This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH RFC] Warn when optimization flag is given without -O


On Wed, May 2, 2012 at 12:03 PM, Alexander Monakov <amonakov@ispras.ru> wrote:
>
>
> On Wed, 2 May 2012, Richard Guenther wrote:
>
>> That's surely too coarse - you will warn about options that _will_
>> have an effect.
>> There is currently no easy way to glob all affected options.
>
> Yeah, that's unfortunate. ?Do we want to have a separate flag
> (CL_OPTIMIZATION_O0) to mark such options? ?Apropos, following is a list of
> options that affect the list of produced dump files at O0. ?If someone knows
> an option that affects compilation at O0, but is not a part of this list,
> please let me know.
>
> -fbranch-probabilities
> -fbranch-target-load-optimize
> -fcombine-stack-adjustments
> -fexceptions
> -fhandle-exceptions
> -fschedule-insns
> -fsplit-wide-types
> -fvar-tracking-assignments
> -fvar-tracking-assignments-toggle
>
>> I don't think we want to warn about -O2 -ftree-pre -O0 either, nor
>
> Huh, I don't see why. ?Please explain?

Because I routinely append -O0 to an existing command-line to disable
optimization.  I don't want to be spammed with unconditional warnings for this
(btw, I think it should be a note(), not a warning).

>> about -fno-tree-pre.
>
> Yeah, that's an oversight in the patch, should be easy to fix.
>
>> Overall I would expect people to have noticed that with -O0 these options have
>> no effect when they've gone all the way to figure out the separate optimization
>> options, no?
>
> At the moment people have two easy ways to find the list of optimization
> options (-fverbose-asm and --help=optimizers), but O0 issue is mentioned
> once not-quite-prominently in the manual and also in the FAQ in the wiki.
> In my opinion, the amount of times I've seen this issue come up warrants
> some effort on making it more visible (thus, a warning).

So maybe prominently say that in the output of --help=optimizers (-fverbose-asm
isn't to be found easily anyway).  Thus, at the end of --help-optimizers print
"Note: without any -On option, excluding -O0, most options do not have any
effect"

Richard.

> Thanks
> Alexander


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]