[Bug tree-optimization/59908] New: Incorrect uninit warning with -fsanitize=address caused by LIM

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 22 17:14:00 GMT 2014


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

            Bug ID: 59908
           Summary: Incorrect uninit warning with -fsanitize=address
                    caused by LIM
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org

struct S
{
  int s;
  struct S *p;
};
extern void bar (void) __attribute__ ((__noreturn__));
extern void baz (struct S **);

void
foo (struct S *x, long c)
{
  int s;
  struct S *y;
  if (c)
    bar ();
lab:
  s = x->s;
  y = x;
  switch (s)
    {
    case 0:
      x = x->p;
      goto lab;
    case 1:
      baz (&y);
    }
}

when compiled with -O2 -Wall -fsanitize=address incorrectly warns about maybe
uninitialized y, with just -O2 -Wall it doesn't (both 4.8 and trunk).

I couldn't find anything wrong in the -fdump-tree-asan1-all dump though, seems
like the problematic uninitialized load is inserted by lim pass, a single store
into y in the loop is replaced by load from uninitialized var before the loop
and 4 different stores after the loop (2 before the __asan_report* noreturn
calls, one before call to baz and one before exit.



More information about the Gcc-bugs mailing list