Fix gfortran.dg/class_to_type_4.f90 deallocation code misordering failure
authorMikael Morin <mikael@gcc.gnu.org>
Fri, 24 Jul 2015 14:44:59 +0000 (14:44 +0000)
committerMikael Morin <mikael@gcc.gnu.org>
Fri, 24 Jul 2015 14:44:59 +0000 (14:44 +0000)
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

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

index 47cfa072aaaca642f9270e1c677ad3bb5d2ae129..0ed6b9bb9013fe2ea4ca864e9cd258b61acac863 100644 (file)
@@ -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
index 89b4dfd3443589a34eb268ff7525c6d02a20f716..be6bfe2006d9996973a3cb32d2eb0a24418fb340 100644 (file)
@@ -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,