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 c/65812] gcc 4.9.1 doesn't warn about uninitialized variable use declared in a switch/case statement when compiled with -O


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65812

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This changed supposedly with r138933 and from that PR20644 I think it is quite
clear this is intentional.  The code in foo_2 is conditional (on a condition
later proved to be always true, though), so we really don't want to warn on it
early, because it might be in dead code, and we don't warn for it late because
it really is dead code, optimized away as nothing uses it.  If you add say a
global void *b; variable and change the a = a; statements to b = a;, then it
will warn even when optimizing, as the code won't be dead.


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