Target: i686-pc-linux-gnulibc2
Configured with: ../configure --prefix=/tmp/gcc-4.3.1 --disable-nls
--enable-shared --with-sysroot=/usr/i686-pc-linux-gnulibc2/
i686-pc-linux-gnulibc2
gcc version 4.3.1 (GCC)

$ gcc -O -Wall -Wuninitialized -c -o t.o t.c
$ gcc -O -Wall -Wuninitialized -fno-unit-at-a-time -c -o t.o t.c
t.c: In function 'f1':
t.c:14: warning: 'pp' may be used uninitialized in this function
$ cat t.c
struct a
{ struct a *n;
  struct b *b;
};

struct b
{ struct b *n;
};

extern struct a *a;

static int
f1 (struct b *b)
{ struct b *pp;
  struct b *p;
  for (p = b; p; p = p->n) pp = p;
  return (!pp);
}

int
f2 (void)
{ struct a *p;
  for (p = a; p; p = p->n) if (f1 (p->b)) return 0;
  return 1;
}

An older version of gcc (gcc (GCC) 3.3.3) works as expected.
A current version of gcc from Debian Unstable (gcc (Debian 4.3.1-6) 4.3.1)
shows the same failure


-- 
           Summary: Fails to warn about possibly uninitialized variables
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: heide-gcc at bfw-online dot de
 GCC build triplet: i686-pc-linux-gnulibc2
  GCC host triplet: i686-pc-linux-gnulibc2
GCC target triplet: i686-pc-linux-gnulibc2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36823

Reply via email to