The master branch has been updated by Jerry DeLisle <[email protected]>:
https://gcc.gnu.org/g:836f029d6a0ee0e6bd88605da994681498f5cf6a
commit r17-2025-g836f029d6a0ee0e6bd88605da994681498f5cf6a
Author: Jerry DeLisle <[email protected]>
Date: Mon Jun 29 08:36:06 2026 -0700
fortran: Fix finalizer list truncated when >= 3 finalizers match [PR121972]
On 6/30/26 8:18 AM, Jerry D wrote:
I will commit the attached patch approved by Paul on MatterMost. This fixes a
memory leak found in the PDT_70 test case.
Regression tested on x86_64
Thanks for review Paul.
Regards,
Jerry
---
fortran: Fix finalizer list truncated when >= 3
finalizers match [PR121972]
When gfc_resolve_finalizers copies matching finalizers from the template
type into a derived type's finalizer list, a linked-list bug caused the
third and later entries to be orphaned. Fix by using the standard
tail-pointer idiom.
PR fortran/121972
gcc/fortran/ChangeLog:
* resolve.cc (gfc_resolve_finalizers): Fix linked-list tail-pointer
bug that dropped all but the first two finalizers from a derived
type's finalizer list when three or more matched.
gcc/testsuite/ChangeLog:
* gfortran.dg/pdt_70.f03: Add a matrix finalizer and update the
check of the value of 'flag'.
---