------- Comment #6 from burnus at gcc dot gnu dot org  2008-01-30 22:14 -------
Paul's patch with and added if condition (see below) nicely compiles all
examples + regtests; however, the example of comment 2 gives a wrong result
("< >" instead of "< 1 2 3 >") [this is independent of the patch]. For that
test case 12 bytes are lost according to valgrind. Actually, if one specifies
the explicit bonds, i.e.  "x%i(1:)" or "x%i(:3)" instead of "x%i(:)" or "x%i",
a temporary variable is created and "< 1 2 3 >" is correctly printed.

       /* Use the scalar assignment as is.  */
+      if (expr->ts.type == BT_DERIVED)
+       {
+         falselhs = gfc_evaluate_now (lse.expr, &lse.pre);
+         falselhs = gfc_deallocate_alloc_comp (expr->ts.derived, falselhs, 0);
+         gfc_add_expr_to_block (&lse.post, falselhs);
+       }
       gfc_add_block_to_block (&block, &lse.pre);


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32795

Reply via email to