Warnings with -Og - gcc 4.8
Tue Mar 5 20:39:00 GMT 2013
On 03/05/2013 01:23 PM, Lars Gullik BjÃ¸nnes wrote:
> I do not see this with any other _optimization_ level.
> I do not get this warning with -O0, nor with -O1, only with -Og.
A minimal amount of optimization is necessary to build the CFG & SSA
graphs which are necessary for the uninitialized use analysis warning.
Thus with -O0 (do not optimize at all), you do not get any warning.
-Og means optimize, but only where doing so will not affect the quality
of debug information. So only a minimal set of optimizations are
performed and you get the warning.
At higher optimization levels (-O1 and above) the compiler will prove
the loop always executes and simplify the control flow graph and
statements accordingly. After those simplifications, the path
containing the uninitialized use is eliminated (it's unreachable) and
thus you do not get the warning.
It's unfortunate that this warning is not stable across different
optimization levels, but for now that's simply how it works.
More information about the Gcc-help