This is the mail archive of the gcc-help@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: Warnings with -Og - gcc 4.8


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.

jeff


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