On Tue, Jun 28, 2022 at 03:59:22PM +0000, Qing Zhao via Gcc-patches wrote: > > On Jun 28, 2022, at 11:08 AM, Jakub Jelinek <ja...@redhat.com> wrote: > > > > On Tue, Jun 28, 2022 at 03:03:12PM +0000, Qing Zhao wrote: > >> 2. Then replace all “array_at_struct_end_p” with using DECL_NOT_FLEXARRAY > >> in GCC, adding new testing cases > > > > No, IMHO array_at_struct_end_p should stay as is, just test this extra flag > > too. > > Could you please explain why we still need “array_at_struct_end_p” after we > have the DECL_NOT_FLEXARRAY flag in FIELD_DECL?
Because the flag just tells whether some array shouldn't be treated as (poor man's) flexible array member. We still need to find out if some FIELD_DECL is to be treated like a flexible array member, which is a minority of COMPONENT_REFs. struct S { int a; char b[0]; int c; } s; struct T { int d; char e[]; }; struct U { int f; struct T g; int h; } u; Neither s.b nor u.g.e is to be treated like flexible array member, no matter what -fstrict-flex-array= option is used. Jakub