[Bug tree-optimization/17252] New: [3.5 Regression] LIM can create wrong code because of aliasing

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Aug 31 19:35:00 GMT 2004


Compile the following with -O2 --param lim-expensive=1 and notice that the load of a is pulled out of 
the loop but we cannot do that because we are accessing what a points to inside the loop and since 
char can alias anything (in C) this is a bug.

char *a;
void g()
{
  int i;
  for(i=0;i<10;i++)a[i] = 0;
}
void h()
{
  a = (char*)&a;
}

-- 
           Summary: [3.5 Regression] LIM can create wrong code because of
                    aliasing
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: critical
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list