aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Morin <mikael@gcc.gnu.org>2015-07-24 14:44:59 +0000
committerMikael Morin <mikael@gcc.gnu.org>2015-07-24 14:44:59 +0000
commit68180ebadd0ac19bbf2ce55bd0625d1d001f7d33 (patch)
treeca2129b91aa3bac51e447ae5d0bf0b803df2e510
parent710ee218547fc4ecbcba7a0f1dff73ce51fffb7b (diff)
downloadgcc-68180ebadd0ac19bbf2ce55bd0625d1d001f7d33.zip
gcc-68180ebadd0ac19bbf2ce55bd0625d1d001f7d33.tar.gz
gcc-68180ebadd0ac19bbf2ce55bd0625d1d001f7d33.tar.bz2
Fix gfortran.dg/class_to_type_4.f90 deallocation code misordering failure
PR fortran/64986 gcc/fortran/ * trans-expr.c (gfc_trans_assignment_1): Put component deallocation code at the beginning of the block. From-SVN: r226162
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-expr.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 47cfa07..0ed6b9b 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2015-07-24 Mikael Morin <mikael@gcc.gnu.org>
+
+ PR fortran/64986
+ * trans-expr.c (gfc_trans_assignment_1): Put component deallocation
+ code at the beginning of the block.
+
2015-07-22 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/61831
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 89b4dfd..be6bfe2 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -9241,7 +9241,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
if (scalar_to_array && dealloc)
{
tmp = gfc_deallocate_alloc_comp_no_caf (expr2->ts.u.derived, rse.expr, 0);
- gfc_add_expr_to_block (&loop.post, tmp);
+ gfc_prepend_expr_to_block (&loop.post, tmp);
}
/* When assigning a character function result to a deferred-length variable,