This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/50171] False positive -Wuninitialized warning
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 24 Aug 2011 00:05:25 +0000
- Subject: [Bug c/50171] False positive -Wuninitialized warning
- Auto-submitted: auto-generated
- References: <bug-50171-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50171
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-08-24 00:05:25 UTC ---
int baz(char **, const char *);
int quux(char *);
int foo(const char *a)
{
char *b;
int t1;
{
char *t;
if (!baz(&t, a))
t1 = -1
b = t;
t1 = 0;
}
if (!t1)
return -1;
return quux(b);
}
--- CUT ---
After some more optimization:
int foo(const char *a)
{
char *b;
char *t;
if (!baz(&t, a))
;
else
return -1;
return quux(b);
}
looks like a correct uninitialized warning to me after inlinining has happened.
b is initialized when the return value (t1) is 0 and uninitialized otherwise.