From ba3ff5c2dbb31cd2e058b4a830eaac1df668ca5b Mon Sep 17 00:00:00 2001 From: Daniel Kraft Date: Thu, 22 Jul 2010 12:59:31 +0200 Subject: [PATCH] trans-stmt.c (gfc_trans_return): Put back in the handling of se.post, now in the correct place. 2010-07-22 Daniel Kraft * trans-stmt.c (gfc_trans_return): Put back in the handling of se.post, now in the correct place. From-SVN: r162409 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/trans-stmt.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1b3f555dd4a..ee2566d4ed3 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2010-07-22 Daniel Kraft + + * trans-stmt.c (gfc_trans_return): Put back in the handling of se.post, + now in the correct place. + 2010-07-21 Steven G. Kargl PR fortran/44929 diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 8abdd885c2c..019555ae7f9 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -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);