https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80983
Bug ID: 80983 Summary: [ F03] memory leak when calling procedure-pointer component with allocatable result Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: janus at gcc dot gnu.org Target Milestone: --- Follow-up to PR 70601 ... The following program is compiled fine by gfortran, but exhibits a memory leak on the PPC call at runtime: program test implicit none type :: concrete_type procedure (alloc_integer), pointer, nopass :: alloc end type procedure (alloc_integer), pointer :: pp type(concrete_type) :: concrete print *, alloc_integer() ! allocated memory is freed pp => alloc_integer print *, pp() ! freed as well concrete % alloc => alloc_integer print *, concrete % alloc() ! memory leak !!! contains function alloc_integer() result(res) integer, allocatable :: res allocate(res, source=13) end function end Effectively this program calls the same function three times. But while freeing the memory works fine for the direct call and the procedure-pointer call, the PPC call misses the memory cleanup.