http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59223
Bug ID: 59223 Summary: -Wmaybe-uninitialized and -Wuninitialized relationships Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: vincent-gcc at vinc17 dot net With: * 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) { int y; if (x == 0) y = 1; else if (x == 1) y = 2; return y; } First test: xvii:~> gcc-snapshot -O2 -Wmaybe-uninitialized -c tst2.c No warning here; -Wuninitialized is needed to trigger the [-Wmaybe-uninitialized] warning (see below). Second test: 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] return y; ^ The use of -Wuninitialized alone has enabled -Wmaybe-uninitialized.