https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178
--- Comment #35 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:afb46540d3921e96c4cd7ba8fa2c8b0901759455 commit r15-7976-gafb46540d3921e96c4cd7ba8fa2c8b0901759455 Author: Jakub Jelinek <ja...@redhat.com> Date: Tue Mar 11 23:08:38 2025 +0100 c: Don't emit -Wunterminated-string-initialization warning for multi-dimensional nonstring array initializers [PR117178] 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. 2025-03-11 Jakub Jelinek <ja...@redhat.com> PR c/117178 * c-typeck.cc (output_init_element): Pass field to digest_init only for record/union types, otherwise pass constructor_fields if non-NULL and constructor_decl if constructor_fields is NULL. * gcc.dg/Wunterminated-string-initialization-2.c: New test.