[Bug middle-end/63184] New: [4.8/4.9/5 Regression] Fails to simplify comparison
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 5 08:32:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63184
Bug ID: 63184
Summary: [4.8/4.9/5 Regression] Fails to simplify comparison
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
c-c++-common/pr19807-2.c
/* { dg-do link } */
extern void link_error(void);
int i;
int main()
{
int a[4];
if ((char*)&a[1] + 4*i + 4 != (char*)&a[i+2])
link_error();
return 0;
}
Fails with all optimization levels for all compilers.
c-c++-common/pr19807-3.c
/* { dg-do link } */
extern void link_error(void);
int i;
int main()
{
int a[4];
if (&a[1] + i + 1 != &a[i+2])
link_error();
return 0;
}
gcc 4.7 passes with -O[01] but fails with -O2+
gcc 4.8 and 4.9 fail with -O0 but passes with -O1+ (thanks to SLSR)
gcc 5.0 since the fix for PR63148 fails
which is a regression.
We don't seem to systematically use sth like the tree-affine.c framework
to simplify address comparisons and the fact that tree-reassoc.c doesn't
in any way associate pointer arithmetic doesn't help either.
More information about the Gcc-bugs
mailing list