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 tree-optimization/31885] New: Not removing empty loop, scev not finding the correct result


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


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