https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121972
--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> --- 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] 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'.
