This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch, Fortran, Committed] Add se.post back in (correctly now) for gfc_trans_return
- From: Daniel Kraft <d at domob dot eu>
- To: Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 22 Jul 2010 13:05:47 +0200
- Subject: [Patch, Fortran, Committed] Add se.post back in (correctly now) for gfc_trans_return
Hi all,
I committed the attached patch as obvious to trunk after a successful
regtest.
Daniel
--
http://www.pro-vegan.info/
--
Done: Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri
2010-07-22 Daniel Kraft <d@domob.eu>
* trans-stmt.c (gfc_trans_return): Put back in the handling of se.post,
now in the correct place.
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);