aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-expr.cc
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2023-10-04 08:26:35 +0100
committerPaul Thomas <pault@gcc.gnu.org>2023-10-04 08:26:35 +0100
commit84284e1c490e9235fca5cb85269ecfcb87eef4f1 (patch)
tree266bf5e6fc50f941d86b5c25e5b8a5c03d087349 /gcc/fortran/trans-expr.cc
parent96557ee6a0a234821af865800d22621efa6e7390 (diff)
downloadgcc-84284e1c490e9235fca5cb85269ecfcb87eef4f1.zip
gcc-84284e1c490e9235fca5cb85269ecfcb87eef4f1.tar.gz
gcc-84284e1c490e9235fca5cb85269ecfcb87eef4f1.tar.bz2
Fortran: Alloc comp of non-finalizable type not finalized [PR111674]
2023-10-04 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/37336 PR fortran/111674 * trans-expr.cc (gfc_trans_scalar_assign): Finalize components on deallocation if derived type is not finalizable. gcc/testsuite/ PR fortran/37336 PR fortran/111674 * gfortran.dg/allocate_with_source_25.f90: Final count in tree dump reverts from 4 to original 6. * gfortran.dg/finalize_38.f90: Add test for fix of PR111674.
Diffstat (limited to 'gcc/fortran/trans-expr.cc')
-rw-r--r--gcc/fortran/trans-expr.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index cca2f4e..860b73c 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -10723,7 +10723,7 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts,
{
tmp_var = gfc_evaluate_now (lse->expr, &lse->pre);
tmp = gfc_deallocate_alloc_comp_no_caf (ts.u.derived, tmp_var,
- 0, true);
+ 0, gfc_may_be_finalized (ts));
if (deep_copy)
tmp = build3_v (COND_EXPR, cond, build_empty_stmt (input_location),
tmp);