https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-8 branch has been updated by Thomas Kथà¤nig <tkoe...@gcc.gnu.org>: https://gcc.gnu.org/g:75f5824b77632ef583a7a65302b326e8bf1b851c commit r8-10289-g75f5824b77632ef583a7a65302b326e8bf1b851c Author: Thomas Koenig <tkoe...@gcc.gnu.org> Date: Sun May 31 10:26:40 2020 +0200 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 <tkoe...@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 <tkoe...@gcc.gnu.org> PR fortran/94361 * gfortran.dg/finalize_28.f90: Adjusted free counts. * gfortran.dg/finalize_34.f90: Likewise. * gfortran.dg/finalize_35.f90: New test. (cherry picked from commit 2a0de88ccf2ecc6659b0f1e4580c1ce5cff976b3)