This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[patch, fortran] Fix PR 87352, far too many deallocations
- From: Thomas Koenig <tkoenig at netcologne dot de>
- To: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Cc: Jeremy Sanders <jeremy at jeremysanders dot net>
- Date: Sun, 31 Mar 2019 18:10:07 +0200
- Subject: [patch, fortran] Fix PR 87352, far too many deallocations
Hello world,
the attached patch attempts to fix PR 87352, a 7/8/9 regression (where
there were far too many deallocations in a derived type containing
allocatable arrays) by making sure that no component is finalized more
than once.
This seemed to be a safer, and simpler, approach to me than to try
to change where, and when double finalization might occur and
when it might be safe to remove it.
This might also cure PR 84487 but, of course, SPEC is closed source,
so I cannot check.
@Jeremy: Can you confirm that this fixes the excessive compile time
and code size issue for you?
OK for trunk and backporting?
Regards
Thomas
2019-03-31 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/87352
* gfortran.h (gfc_component): Add finalized field.
* class.c (finalize_component): If the component is already
finalized, return early. Set component->finalized on exit.
2019-03-31 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/87352
* gfortran.dg/finalize_28.f90: Adjust count of __builtin_free.
* gfortran.dg/finalize_33.f90: Likewise.
* gfortran.dg/finalize_34.f90: New test.