https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117516
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Actually, the warning as implemented doesn't really diagnose all the bugs, just the first one, and e.g. on struct A { int a; char b[]; int c; }; struct B { struct A d; struct A e[]; struct A f; }; struct C { struct B g; struct B h[]; struct B i; }; struct D { struct C j; }; D k; just diagnoses the same bug 4 times: pr117516-2.C:1:24: error: flexible array member ‘A::b’ not at end of ‘struct A’ 1 | struct A { int a; char b[]; int c; }; | ^ pr117516-2.C:1:24: error: flexible array member ‘A::b’ not at end of ‘struct B’ pr117516-2.C:1:24: error: flexible array member ‘A::b’ not at end of ‘struct C’ pr117516-2.C:1:24: error: flexible array member ‘A::b’ not at end of ‘struct D’ Either it should diagnose all bugs but once each, so in the above case that A::b is not at the end of struct A, B::e is not at end of struct B, C::h is not at end of struct D, or just the first bug at each level.