[Bug tree-optimization/31885] New: Not removing empty loop, scev not finding the correct result

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed May 9 23:21:00 GMT 2007


Hi, when working on the pointer plus branch I noticed that we fail to remove an
empty finite loop, we would fold &array p+ 4 into &array[1] and then scev would
get the incorrect result and not optimize it.
Here is a testcase which is producable on the mainline:
struct s {
  int *blah;
};

static struct s array[] = {
  { 0 }
};

void
foo (struct s *p)
{
  struct s *q = &array[1];
  while (p < q)
    p++;
}


------------- cut -----
The orginal function looked like:
void
foo (struct s *p)
{
  unsigned int n = 1;
  struct s *q = &array[n];
  while (p < q)
    p++;
}


-- 
           Summary: Not removing empty loop, scev not finding the correct
                    result
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list