http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47455

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-25 
20:32:53 UTC ---
RFC patch. Janus, what do you think?

(Compiles and works for the example; no further tests.)

--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -5929,6 +5929,9 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr *
expr2, bool init_flag,
       gfc_add_expr_to_block (&loop.post, tmp);
     }

+  if (expr2->expr_type == EXPR_FUNCTION && gfc_expr_attr (expr2).proc_pointer)
+    rse.expr = build_fold_indirect_ref_loc (input_location, rse.expr);
+
   tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts,
                                 l_is_temp || init_flag,
                                 expr_is_variable (expr2) || scalar_to_array,

Reply via email to