OSDN Git Service

2008-12-22 Paul Thomas <pault@gcc.gnu.org>
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Dec 2008 23:11:29 +0000 (23:11 +0000)
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Dec 2008 23:11:29 +0000 (23:11 +0000)
PR fortran/35780
* trans-decl.c (init_intent_out_dt): Allow for optional args.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142889 138bc75d-0d04-0410-961f-82ee72b054a4

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

index b3e3034..f727f80 100644 (file)
@@ -1,3 +1,8 @@
+2008-12-22  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/35780
+       * trans-decl.c (init_intent_out_dt): Allow for optional args.
+
 2008-12-21  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR fortran/38398
index 91db5df..af6d01a 100644 (file)
@@ -2791,6 +2791,7 @@ init_intent_out_dt (gfc_symbol * proc_sym, tree body)
   stmtblock_t fnblock;
   gfc_formal_arglist *f;
   tree tmp;
+  tree present;
 
   gfc_init_block (&fnblock);
   for (f = proc_sym->formal; f; f = f->next)
@@ -2802,6 +2803,11 @@ init_intent_out_dt (gfc_symbol * proc_sym, tree body)
            tmp = gfc_deallocate_alloc_comp (f->sym->ts.derived,
                                             f->sym->backend_decl,
                                             f->sym->as ? f->sym->as->rank : 0);
+
+           present = gfc_conv_expr_present (f->sym);
+           tmp = build3 (COND_EXPR, TREE_TYPE (tmp), present,
+                         tmp, build_empty_stmt ());
+
            gfc_add_expr_to_block (&fnblock, tmp);
          }