https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62171
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- I was thinking about sth like struct X { int i; int * __restrict__ q; }; int foo (X& __restrict__ x, X *p) { *x.q = 1; p->i = 0; return *x.q; } int main() { X x; x.q = &x.i; return foo (x, &x); } but I see we're still conservatively requiring decls in visit_loadstore: tree ptr = TREE_OPERAND (base, 0); if (TREE_CODE (ptr) == SSA_NAME) { /* ??? We need to make sure 'ptr' doesn't include any of the restrict tags in its points-to set. */ return false; Of course this kind of testcase would also break if X were passed by value (and changed by the frontend to DECL_BY_REFERENCE). That is, using the 2nd level restrict sounds bogus iff there can be a testcase that can be created by the user (thus is not under strict control by the compiler). That said, generally the tree-ssa-structalias.c:visit_loadstore needs some more sophistication as well.