PR19639 is pessimized by (?) extern void link_error(void); int main(void) { int a[4]; if (&a[2]-1 != &a[1]) link_error(); return 0; }
where for C++ (!!) we do not fold the addition of ADDR_EXPR (ARRAY_REF (..)) and INTEGER_CST into the ARRAY_REF offset. For C the frontend avoids passing ARRAY_REFs to fold. -- Summary: fold does not fold &a[4]-1 Product: gcc Version: 4.0.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P2 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org OtherBugsDependingO 19639 nThis: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19807