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