Pushed after full testing. Fairly obvious
Thanks Paul
Regards,
Jerry
commit 1a2de01fbac64f97fed6f63ff655b13bff831877 (HEAD -> master, origin/master,
origin/HEAD)
Author: Paul Thomas <[email protected]>
Date: Tue Jun 30 10:39:57 2026 +0100
Fortran: Fix memory leak found in pdt_86.f03 [PR121972]
Followup on memory leaks found using -fsanitize=address
in existing test cases.
Co-authored-by: Jerry DeLisle <[email protected]>
PR fortran/121972
gcc/fortran/
* decl.cc (gfc_get_pdt_instance): A PDT that has a derived type
component, which has allocatable components, must be marked as
having allocatable components.
* resolve.cc (gfc_resolve_ref): Initialize last_pdt from the base
symbol's declared type when the expression type is not a PDT.
gcc/testsuite/
* gfortran.dg/pdt_86.f03: Add tree dump for counts of frees and
mallocs (41 & 31 respectively).
* gfortran.dg/pdt_86_reduced.f90: New test to check that the
non-PDT version of the leak has gone.