This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/35609] New: [4.3/4.4 Regression] bogus "is used uninitialized in this function" warning


<--  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]