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, 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?

> 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).

Thanks
Alexander


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