Patchwork [Fortran,Committed] Add se.post back in (correctly now) for gfc_trans_return

login
register
mail settings
Submitter Daniel Kraft
Date July 22, 2010, 11:05 a.m.
Message ID <4C48260B.4080800@domob.eu>
Download mbox | patch
Permalink /patch/59562/
State New
Headers show

Comments

Daniel Kraft - July 22, 2010, 11:05 a.m.
Hi all,

I committed the attached patch as obvious to trunk after a successful 
regtest.

Daniel
Daniel Kraft - July 22, 2010, 11:13 a.m.
Daniel Kraft wrote:
> Hi all,
> 
> I committed the attached patch as obvious to trunk after a successful 
> regtest.

... as revision 162409.

Patch

Index: gcc/fortran/trans-stmt.c
===================================================================
--- gcc/fortran/trans-stmt.c	(revision 162373)
+++ gcc/fortran/trans-stmt.c	(working copy)
@@ -517,9 +517,13 @@  gfc_trans_return (gfc_code * code)
 
       gfc_conv_expr (&se, code->expr1);
 
+      /* Note that the actually returned expression is a simple value and
+	 does not depend on any pointers or such; thus we can clean-up with
+	 se.post before returning.  */
       tmp = fold_build2 (MODIFY_EXPR, TREE_TYPE (result), result,
 			 fold_convert (TREE_TYPE (result), se.expr));
       gfc_add_expr_to_block (&se.pre, tmp);
+      gfc_add_block_to_block (&se.pre, &se.post);
 
       tmp = gfc_generate_return ();
       gfc_add_expr_to_block (&se.pre, tmp);