<--  snip  -->

$ cat test.c
int foo, bar;

void decode_reloc(int reloc, int *is_alt)
{
  if (reloc >= 20)
      *is_alt = 1;
  else if (reloc >= 10)
      *is_alt = 0;
}

void testfunc()
{
  int alt_reloc;

  decode_reloc(foo, &alt_reloc);

  if (alt_reloc)
    bar = 42;
}
$ gcc -O2 -Wall -c test.c
test.c: In function ‘testfunc’:
test.c:17: warning: ‘alt_reloc’ is used uninitialized in this function
$ 

<--  snip  -->

A "may be used uninitialized in this function" warning might be appropriate
here, but gcc seems to wrongly think it can prove "alt_reloc" was for sure
uninitialized here.


-- 
           Summary: [4.3/4.4 Regression] bogus "is used uninitialized in
                    this function" warning
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bunk at stusta dot de


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

Reply via email to