https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91108
Bug ID: 91108 Summary: [8/9/10 Regression] Fails to pun through unions Product: gcc Version: 9.1.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: --- The following testcase fails to support our promise for punning through union members if the access happens through the union. /* { dg-do run } */ /* { dg-options "-O3 -fstrict-aliasing" } */ union U { struct A { int : 2; int x : 8; } a; struct B { int : 6; int x : 8; } b; }; int __attribute__((noipa)) foo (union U *p, union U *q) { p->a.x = 1; q->b.x = 1; return p->a.x; } int main() { union U x; if (foo (&x, &x) != x.a.x) __builtin_abort (); return 0; }