This is the mail archive of the gcc-patches@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]

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


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