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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-09-14 
16:40:08 UTC ---
(In reply to comment #3)
> Patch:

I have accidentally submitted the patch before testing finished. It does not
work. The problem is that it does create the required declaration - but it does
not get used as one later calls  gfc_get_fake_result_decl, which does not
propagate this information on.

That's fixed by applying additionally the following patch, which feels slightly
hackish.

--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -2557,6 +2561,9 @@ gfc_get_fake_result_decl (gfc_symbol * sym, int
parent_flag)
   else
     current_fake_result_decl = build_tree_list (NULL, decl);

+  if (sym->attr.assign)
+    DECL_LANG_SPECIFIC (decl) = DECL_LANG_SPECIFIC (sym->backend_decl);
+
   return decl;
 }


... maybe by moving the  gfc_add_assign_aux_vars  to gfc_get_fake_result_decl -
like below?

@@ -2501,6 +2501,10 @@ gfc_get_fake_result_decl (gfc_symbol * sym, int
parent_flag)
   if (!sym)
     return NULL_TREE;

+  if (sym->attr.assign
+      && GFC_DECL_ASSIGN (sym->backend_decl) == 0)
+    gfc_add_assign_aux_vars (sym);
+
   if (sym->ts.type == BT_CHARACTER)
     {
       if (sym->ts.u.cl->backend_decl == NULL_TREE)

Reply via email to