On Mon, Sep 26, 2011 at 06:01:45PM +0200, Jakub Jelinek wrote: > In the above function with this e.g. a[4] object is modified during > the extecution of the foo block B, thus the 6.7.3.1/4 rules should apply. > And within that block a[4] is accessed through lvalues whose address > is p1 based as well as through lvalues whose address is not p1 based > (is p2 based), therefore it is invalid.
I think better testcase would be: void foo (int *x, int y) { int * __restrict p1 = x; #ifdef WORKAROUND int *p3 = x + y; int * __restrict p2 = p3; #else int * __restrict p2 = x + y; #endif int *p; int *q; int i; for (i = 0; i < 32; ++i) p1[i] = p2[i]; p = p1; q = p2 - 31; for (i = 0; i < 32; ++i) p[i] = q[i]; } which would be invalid to call with foo (a, 32); given the above, but it isn't obvious to the compiler what value y has. With -DWORKAROUND the PT decls in (restr) look correct, without that not (supposedly because of the folding of the initializer), still, the vectorizer together with the alias oracle don't figure out they can omit the non-overlap tests before both loops. Jakub