This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/44547] -Wuninitialized reports false warning in nested switch statements (missed switch optimization)



------- Comment #5 from manu at gcc dot gnu dot org  2010-06-17 08:37 -------
(In reply to comment #4)
> It seems that optimizing is what's causing the problem: the example compiles
> fine with -O0, but not -On>=1. It also compiles fine when the case values are
> consecutive, which seems telling. My first guess would be to take a look at
> what optimizations are being done to switch statements that have
> non-consecutive-valued cases as opposed to those that have consecutive values.
> 

Wuninitialized does not detect as many cases with -O0 than with higher
optimizations. When the cases are consecutive, VRP kicks in and simplifies the
switch. You can check what is going on using -fdump-tree-all-lineno and
inspecting the dumps. n(D) means the uninitialized value of n. When that is
removed, then Wuninitialized will not warn.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44547


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