https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89509
Bug ID: 89509 Summary: restrict doesnt work with subfield accesses Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- struct S { int i; void *p; int j; }; int foo (struct S * __restrict p, int *q, int flag) { int *x = &p->j; if (flag) x = &p->i; *q = 1; *x = 2; return *q; } Is not optimized to return 1. This is the missed-optimization part of PR89505.