https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50410
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gcc dot gnu.org --- Comment #40 from anlauf at gcc dot gnu.org --- (In reply to kargl from comment #39) > The bug is not fixed. The code from comment #3 > > % cat a.f90 > type t > integer g > end type > type(t) :: u=t(1) > data u%g /2/ > end The patch diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index b7c568e90e6..02caf992dfd 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -8543,7 +8543,7 @@ gfc_conv_structure (gfc_se * se, gfc_expr * expr, int init) cm = expr->ts.u.derived->components; for (c = gfc_constructor_first (expr->value.constructor); - c; c = gfc_constructor_next (c), cm = cm->next) + c && cm; c = gfc_constructor_next (c), cm = cm->next) { /* Skip absent members in default initializers and allocatable components. Although the latter have a default initializer fixes the ICE, but does not detect the double initialization. > The code in the first example in comment #9 also causes an ICE. This one then works and produces the expected error. > Codes z1.f90, z2.f90, and z3.f90 in comment #23 cause ICEs. Only z1 ICEs, z2 and z3 produce error messages.