r194403 - Using an invalid -O falls back on -O3 instead of an error

Hal Finkel hfinkel at anl.gov
Mon Nov 11 11:52:02 PST 2013


----- Original Message -----
> 
> 
> 
> 
> 
> On Mon, Nov 11, 2013 at 11:01 AM, Sylvestre Ledru <
> sylvestre at debian.org > wrote:
> 
> 
> 
> Using an invalid -O falls back on -O3 instead of an error
> 
> Summary:
> Currently with clang:
> $ clang -O20 foo.c
> error: invalid value '20' in '-O20'
> 
> With the patch:
> $ clang -O20 foo.c
> warning: invalid value '20' in '-O20'. Fall back on value '3'
> Sorry that I missed the original thread here, but why is this the
> desired behavior?

Because it is the sensible thing to do ;) -- Users tend to assume that the higher the number the more optimizations they're getting. Having -O5 do less than -O3 would be very confusing. If we end up with a -O4, then we'll change that to be the fall back for large -O<n>, etc.

 -Hal

> 
> 
> My preference would be to have '-O' be the fallback, and that in turn
> be equivalent to '-O2' which is often viewed as a reasonable default
> level of optimization.
> 
> 
> I just don't like reading too munch into invalid numbers given to
> -O...
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the cfe-commits mailing list