[Bug fortran/121972] [PDT] pdt_70/77/86.f03 leak memory

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 30 15:19:43 GMT 2026


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 <jvdelisle@gcc.gnu.org>:

https://gcc.gnu.org/g:836f029d6a0ee0e6bd88605da994681498f5cf6a

commit r17-2025-g836f029d6a0ee0e6bd88605da994681498f5cf6a
Author: Jerry DeLisle <jvdelisle@gcc.gnu.org>
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'.


More information about the Gcc-bugs mailing list