This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/31885] New: Not removing empty loop, scev not finding the correct result
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 May 2007 23:21:31 -0000
- Subject: [Bug tree-optimization/31885] New: Not removing empty loop, scev not finding the correct result
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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