On Tue, 11 Mar 2025, Jakub Jelinek wrote: > Hi! > > My/Kees' earlier patches adjusted -Wunterminated-string-initialization > warning so that it doesn't warn about initializers of nonstring decls > and that nonstring attribute is allowed on multi-dimensional arrays. > Unfortunately as this testcase shows, we still warn about initializers > of multi-dimensional array nonstring decls. > > The problem is that in that case field passed to output_init_element > is actually INTEGER_CST, index into the array. > For RECORD_OR_UNION_TYPE_P (constructor_type) field is a FIELD_DECL > which we want to use, but otherwise (in arrays) IMHO we want to use > constructor_fields (which is the innermost FIELD_DECL whose part > is being initialized), or - if that is NULL - constructor_decl, the > whole decl being initialized with multi-dimensional array type. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
OK, though it would be good also to have some tests using designated initializers (so [1][2] = "abc" and similar). -- Joseph S. Myers josmy...@redhat.com