https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50410
--- Comment #41 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- In my working tree I had the following patch --- /opt/gcc/_clean-svn//gcc/fortran/trans-expr.c 2020-01-05 11:44:35.000000000 +0100 +++ /opt/gcc/work-cvs/gcc/fortran/trans-expr.c 2020-01-05 11:45:38.000000000 +0100 @@ -8366,7 +8366,7 @@ gfc_trans_structure_assign (tree dest, g gfc_init_se (&se, NULL); 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. */ if (!c->expr && !cm->attr.allocatable) @@ -8447,6 +8447,7 @@ gfc_trans_structure_assign (tree dest, g expr->ts.u.derived, init); gfc_add_expr_to_block (&block, tmp); } + gcc_assert (!c); return gfc_finish_block (&block); } @@ -8519,7 +8520,7 @@ gfc_conv_structure (gfc_se * se, gfc_exp 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 @@ -8564,6 +8565,11 @@ gfc_conv_structure (gfc_se * se, gfc_exp CONSTRUCTOR_APPEND_ELT (v, cm->backend_decl, val); } } + /* gcc_assert (!c); */ + if (c) + /* gfc_error ("Invalid DATA statement at %C."); + gfc_error ("Invalid DATA statement at %L.", &expr->where); */ + gfc_error ("Invalid DATA statement at %L.", &gfc_current_locus); se->expr = build_constructor (type, v); if (init) I have never seen the first assert triggering and I never found a way to emit a better error message.