[Bug middle-end/59225] New: missing maybe uninitialized warning following single if
vincent-gcc at vinc17 dot net
gcc-bugzilla@gcc.gnu.org
Thu Nov 21 03:12:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59225
Bug ID: 59225
Summary: missing maybe uninitialized warning following single
if
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: minor
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]
xvii:~> cat tst1.c
int foo (int x)
{
int y;
if (x == 0)
y = 1;
return y;
}
"gcc-snapshot -O2 -Wuninitialized -c tst1.c" doesn't emit any warning.
If I change the code to:
xvii:~> cat tst2.c
int foo (int x)
{
int y;
if (x == 0)
y = 1;
else if (x == 1)
y = 2;
return y;
}
I get the following warning as expected:
tst2.c:8:3: warning: 'y' may be used uninitialized in this function
[-Wmaybe-uninitialized]
return y;
^
More information about the Gcc-bugs
mailing list