http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49771
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-18 18:45:56 UTC --- Yeah, that indeed fixes this testcase, and in addition keeps static int a[2000]; int foo (void) { int j; int i; for (i = 0; i < 1000; i++) for (j = 0; j < 1000; j++) a[j] = a[1000 + i] + 1; return a[0]; } doing the non-aliased loop (which I assume was the original intent of Richard's patch). It would be nice if GCC could figure this out at compile time in this case though, it should know that on the #c0 testcase one of the accesses is 4 bytes from &a[0] to &a[999] and the other can already be seen to be &a[0] through &a[1000], so should be able to say that they always do alias. In the testcase from this comment that they never alias.