[Bug c/50171] False positive -Wuninitialized warning

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Aug 24 03:12:00 GMT 2011


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.



More information about the Gcc-bugs mailing list