http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46562
Summary: CCP currently needs iteration for &a[i] Product: gcc Version: 4.6.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization AssignedTo: rgue...@gcc.gnu.org ReportedBy: rgue...@gcc.gnu.org static int a[4]; int foo(void) { int i = 1; int *p = &a[i]; return *p; } compiled with the C++ FE (to yield an ARRAY_REF) shows that CCP needs to iterate to figure out that p is a constant (and thus fold the read from a[1]).