]> git.ipfire.org Git - thirdparty/gcc.git/commit
Finalization depends on the expression, not on the component.
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 31 May 2020 08:26:40 +0000 (10:26 +0200)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Mon, 1 Jun 2020 18:25:56 +0000 (20:25 +0200)
commit2a0de88ccf2ecc6659b0f1e4580c1ce5cff976b3
tree6486a87fe8343e437c5f516c9edd1a280c1d531f
parent0e6aad5d9561e4df611e588f0cb1d819f41cdc27
Finalization depends on the expression, not on the component.

This patch fixes a 8/9/10/11 regression, where finalized types
were not finalized (and deallocated), which led to memory
leaks.

gcc/fortran/ChangeLog:

2020-05-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/94361
* class.c (finalize_component): Use expr->finalized instead of
comp->finalized.
* gfortran.h (gfc_component): Remove finalized member.
(gfc_expr): Add it here instead.

gcc/testsuite/ChangeLog:

2020-05-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/94361
* gfortran.dg/finalize_28.f90: Adjusted free counts.
* gfortran.dg/finalize_33.f90: Likewise.
* gfortran.dg/finalize_34.f90: Likewise.
* gfortran.dg/finalize_35.f90: New test.

(cherry picked from commit 811f902b764c5a13178cbd7588e96c16b3fab504)
- [new file with mode: 0644]
gcc/fortran/class.c
gcc/fortran/gfortran.h
gcc/testsuite/gfortran.dg/finalize_28.f90
gcc/testsuite/gfortran.dg/finalize_33.f90
gcc/testsuite/gfortran.dg/finalize_34.f90
gcc/testsuite/gfortran.dg/finalize_35.f90 [new file with mode: 0644]