https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100950
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #4 from kargl at gcc dot gnu.org --- (In reply to Richard Biener from comment #3) > So we hit > > /* Check if a STRING_CST fits into the field. > Tolerate only the case when the NUL termination > does not fit into the field. */ > > static bool > check_string_literal (tree string, unsigned HOST_WIDE_INT size) > { > ... > if (mem_size != size) > return false; > > so in this case the NUL termination is missing. TREE_STRING_LENGTH is 1 > but the field size is 2. The CTOR is > > {"a", "b"} > > and has a type of char[2][2]. Looks like a FE bug to me. Yes, it's a FE bug. If the line is changed to print *, [character(len(x(1:2))) :: 'a ', ' b'] or print *, [character(len(x(1:1))) :: 'a', 'b'] the code compiles and runs as expected. The type declaration is set to 2 while the elements in the constructor have a len of 1. The FE should likely check for too short of an element and blank pad. However, someone needs to check if this is a valid structure constructor, because technically the elements are type incompatible with declared type (ie., different type kind parameters).