re PR fortran/32903 (Default initializer and intent(OUT): default initializer not...
authorPaul Thomas <pault@gcc.gnu.org>
Fri, 27 Jul 2007 09:03:41 +0000 (09:03 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Fri, 27 Jul 2007 09:03:41 +0000 (09:03 +0000)
2007-07-27  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/32903
* trans-decl.c (gfc_trans_deferred_vars): Set intent(out)
derived types as referenced, if they have the the default
initializer set.

From-SVN: r126974

gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c

index cb7cae7..b0089ef 100644 (file)
@@ -1,10 +1,17 @@
+2007-07-27  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/32903
+       * trans-decl.c (gfc_trans_deferred_vars): Set intent(out)
+       derived types as referenced, if they have the the default
+       initializer set.
+
 2007-07-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * gfortran.h (generate_isocbinding_symbol): Constify.
        * symbol.c (gen_special_c_interop_ptr, gen_cptr_param,
        generate_isocbinding_symbol): Likewise.
 
-2007-07-24 Paul Thomas <pault@gcc.gnu.org>
+2007-07-24  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/31205
        PR fortran/32842
index 6c6cba0..8a3b968 100644 (file)
@@ -2735,8 +2735,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tree fnbody)
 
       /* If an INTENT(OUT) dummy of derived type has a default
         initializer, it must be initialized here.  */
-      if (f->sym && f->sym->attr.referenced
-           && f->sym->attr.intent == INTENT_OUT
+      if (f->sym && f->sym->attr.intent == INTENT_OUT
            && f->sym->ts.type == BT_DERIVED
            && !f->sym->ts.derived->attr.alloc_comp
            && f->sym->value)
@@ -2744,6 +2743,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tree fnbody)
          gfc_expr *tmpe;
          tree tmp, present;
          gcc_assert (!f->sym->attr.allocatable);
+         gfc_set_sym_referenced (f->sym);
          tmpe = gfc_lval_expr_from_sym (f->sym);
          tmp = gfc_trans_assignment (tmpe, f->sym->value, false);