This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/32795] allocatable components are nullified prematurely



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]