https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64209
janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |janus at gcc dot gnu.org --- Comment #4 from janus at gcc dot gnu.org --- The following patch is sufficient to make the reduced test case in comment 2 work: Index: gcc/fortran/trans-expr.c =================================================================== --- gcc/fortran/trans-expr.c (Revision 218874) +++ gcc/fortran/trans-expr.c (Arbeitskopie) @@ -980,6 +980,9 @@ gfc_trans_class_init_assign (gfc_code *code) src.expr = gfc_build_addr_expr (NULL_TREE, src.expr); tmp = gfc_build_memcpy_call (dst.expr, src.expr, memsz.expr); + + tmp = build3_loc (input_location, COND_EXPR, TREE_TYPE (tmp), + src.expr, tmp, build_empty_stmt (input_location)); } if (code->expr1->symtree->n.sym->attr.optional However, the original test case in comment 0 still segfaults, so there seems to be yet another problem.