------- Comment #6 from pault at gcc dot gnu dot org 2009-06-28 20:31 ------- (In reply to comment #5) The following fixes the problem. It needs to be checked to see if it is over-restrictive.
Index: gcc/fortran/trans-expr.c =================================================================== --- gcc/fortran/trans-expr.c (revision 149003) +++ gcc/fortran/trans-expr.c (working copy) @@ -4818,7 +4823,8 @@ tree tmp; /* Special case a single function returning an array. */ - if (expr2->expr_type == EXPR_FUNCTION && expr2->rank > 0) + if (expr2->expr_type == EXPR_FUNCTION && expr2->rank > 0 + && !(expr1->ref && !gfc_full_array_ref_p (expr1->ref))) { tmp = gfc_trans_arrayfunc_assign (expr1, expr2); if (tmp) Cheers Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40551