https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93582
Bug ID: 93582 Summary: -Warray-bounds gives error: array subscript 0 is outside array bounds of struct E[1] Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: mpolacek at gcc dot gnu.org Target Milestone: --- Reduced from libXt: struct E { } e; struct A { unsigned long *l; }; struct C { unsigned long *l; } c; void bar (struct E *ep) { c.l = ((struct A*) ((ep) + 1))->l; } void f () { bar (&e); } $ ./cc1 -quiet -O3 x.c -Warray-bounds x.c: In function ‘f’: x.c:15:33: warning: array subscript 0 is outside array bounds of ‘struct E[1]’ [-Warray-bounds] 15 | c.l = ((struct A*) ((ep) + 1))->l; | ~~~~~~~~~~~~~~~~~~~~~~~~^~~ x.c:2:3: note: while referencing ‘e’ 2 | } e; | ^