https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68155
Harald Anlauf <anlauf at gmx dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gmx dot de --- Comment #9 from Harald Anlauf <anlauf at gmx dot de> --- Playing around with the code in comment #6, with default initialization within the type: program p implicit none type t ! character(3) :: c2(2) = ['b', 'c'] // 'a' ! lacks padding? / ICE character(3) :: c3(2) = ['b', 'c'] // 'ax' ! OK character(3) :: c4(2) = ['b', 'c'] // 'axy' ! only partially OK end type type(t) :: z character(3) :: c c = z%c3(1) ! OK print *, c c = z%c3(2) ! OK print *, c c = z%c4(1) ! OK print *, c c = z%c4(2) ! truncated print *, c end This prints: bax cax bax ca The dump tree starts with: p () { character(kind=1) c[1:3]; static struct t z = {.c3={"bax", "cax"}, .c4={"bax ", "cax "}}; __builtin_memmove ((void *) &c, (void *) &z.c3[0], 3); [...] __builtin_memmove ((void *) &c, (void *) &z.c4[1], 3); [...] I do not see from the dump tree what could be wrong with the character lengths, but somehow the truncation in the last print needs to be understood. Enabling the line with c2 and adding a line c = z%c2(1) to the main produces in the dump static struct t z = {.c2={"ba", "ca"}, .c3={"bax", "cax"}, .c4={"bax ", "cax "}}; __builtin_memmove ((void *) &c, (void *) &z.c2[0], 3); which should not happen.