https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61831
--- Comment #42 from Mikael Morin <mikael at gcc dot gnu.org> --- (In reply to Mikael Morin from comment #41) > My work patch is: updated work patch below. The testcase passes with it, at the price of leaking memory Index: trans-expr.c =================================================================== --- trans-expr.c (révision 220717) +++ trans-expr.c (copie de travail) @@ -4949,7 +4949,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * if (e && (e->ts.type == BT_DERIVED || e->ts.type == BT_CLASS) && e->ts.u.derived->attr.alloc_comp && !(e->symtree && e->symtree->n.sym->attr.pointer) - && (e->expr_type != EXPR_VARIABLE && !e->rank)) + && (e->expr_type != EXPR_VARIABLE + && e->expr_type != EXPR_STRUCTURE && !e->rank)) { int parm_rank; tmp = build_fold_indirect_ref_loc (input_location, @@ -7131,7 +7132,8 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * e if (expr->ts.type == BT_DERIVED && expr->rank && !gfc_is_finalizable (expr->ts.u.derived, NULL) && expr->ts.u.derived->attr.alloc_comp - && expr->expr_type != EXPR_VARIABLE) + && expr->expr_type != EXPR_VARIABLE + && expr->expr_type != EXPR_ARRAY) { tree tmp;