User account creation filtered due to spam.
* gcc-4.8 (Debian 4.8.2-5) 4.8.2
* gcc (Debian 20131021-1) 4.9.0 20131021 (experimental) [trunk revision 203899]
It seems that -Wmaybe-uninitialized works only if -Wuninitialized is enabled. Moreover -Wmaybe-uninitialized is enabled by -Wuninitialized. I wonder whether this is intended or something is missing in the man page (the gcc 4.8.2 one doesn't say anything about these relationships).
xvii:~> cat tst2.c
int foo (int x)
if (x == 0)
y = 1;
else if (x == 1)
y = 2;
xvii:~> gcc-snapshot -O2 -Wmaybe-uninitialized -c tst2.c
No warning here; -Wuninitialized is needed to trigger the [-Wmaybe-uninitialized] warning (see below).
xvii:~> gcc-snapshot -O2 -Wuninitialized -c tst2.c
tst2.c: In function 'foo':
tst2.c:8:3: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
The use of -Wuninitialized alone has enabled -Wmaybe-uninitialized.
I am pretty sure that this is an oversight when the option got renamed. In particular, this seems appropriate:
--- tree-ssa-uninit.c (revision 205089)
+++ tree-ssa-uninit.c (working copy)
@@ -2175,7 +2175,7 @@
- return warn_uninitialized != 0;
+ return warn_uninitialized || warn_maybe_uninitialized;
since the pass can warn for both options and the warnings are already guarded by the appropriate OPT_W* code.
*** Bug 60294 has been marked as a duplicate of this bug. ***
I'll post a patch.
Date: Thu Feb 27 08:05:21 2014
New Revision: 208196
* tree-ssa-uninit.c (gate_warn_uninitialized): Run the pass even for
* c-c++-common/pr59223.c: New test.