https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61831
--- Comment #23 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- Could you test the following patch? --- ../_clean/gcc/fortran/trans-expr.c 2014-07-07 22:48:04.000000000 +0200 +++ gcc/fortran/trans-expr.c 2014-07-18 21:28:24.000000000 +0200 @@ -6512,7 +6512,10 @@ gfc_conv_expr_reference (gfc_se * se, gf 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 + || (expr->expr_type == EXPR_ARRAY + && expr->ts.u.derived->refs == 1))) { tree tmp;