[PATCH] Using an invalid -O falls back on -O3 instead of an error
Yunzhong Gao
Yunzhong_Gao at playstation.sony.com
Thu Oct 2 17:44:16 PDT 2014
There is a problem in this implementation. At Line#302 of lib/Frontend/CompilerInvocation.cpp:
Opts.OptimizationLevel = getOptimizationLevel(Args, IK, Diags);
Notice that Opts.OptimizationLevel is a 3-bit bitfield, so any optimization bigger than 8 are truncated, so
for example, in test/Driver/invalid-o-level.c, you have checked that you get a nice diagnostic for -O900, but
if you try -O899, you will not get any diagnostics.
I think one needs to diagnose on the unsigned optimization level before assigning it to the bitfield.
http://reviews.llvm.org/D2152
More information about the cfe-commits
mailing list