https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61831
--- Comment #41 from Mikael Morin <mikael at gcc dot gnu.org> --- Created attachment 34846 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34846&action=edit extended testcase My work patch is: Index: trans-expr.c =================================================================== --- trans-expr.c (révision 220717) +++ trans-expr.c (copie de travail) @@ -7131,7 +7131,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; It fails with the above testcase at line 80. ptr_in in simple-copied twice to elements of an array, which is itself copied to the temporary structure of the structure constructor. After using the latter, the temporary structure cleanup code frees ptr_in (twice).