]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: Ensure finalizers are created correctly [PR120637]
authorAndre Vehreschild <vehre@gcc.gnu.org>
Wed, 25 Jun 2025 12:46:16 +0000 (14:46 +0200)
committerAndre Vehreschild <vehre@gcc.gnu.org>
Tue, 8 Jul 2025 07:48:43 +0000 (09:48 +0200)
commitd1f05661fa6c8a6ea6f59ad365a84469100e425e
treed859869adeb530d8fb751e3534c775f6ba37f0be
parentaa5ae523e84a97bf3a582ea0fa73d959afa9b9c7
Fortran: Ensure finalizers are created correctly [PR120637]

Finalize_component freeed an expression that it used to remember which
components in which context it had finalized already.  While it makes
sense to free the copy of the expression, if it is unused, it causes
issues, when comparing to a non existent expression. This is now
detected by returning true, when the expression has been used.

PR fortran/120637

gcc/fortran/ChangeLog:

* class.cc (finalize_component): Return true, when a finalizable
component was detect and do not free it.

gcc/testsuite/ChangeLog:

* gfortran.dg/asan/finalize_1.f90: New test.
gcc/fortran/class.cc
gcc/testsuite/gfortran.dg/asan/finalize_1.f90 [new file with mode: 0644]