https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60922
janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW --- Comment #6 from janus at gcc dot gnu.org --- Here is a reduced and cleaned-up test case: program test_leak implicit none type d_base_vect_type end type type d_vect_type class(d_base_vect_type), allocatable :: v end type type(d_vect_type) :: ainvd integer :: itx do itx=1,2 write(*,*) 'Iteration ',itx call d_vect_bld_x(ainvd) end do contains subroutine d_vect_bld_x(x) class(d_vect_type), intent(out) :: x allocate(x%v) end subroutine end program With 4.9 and trunk (but not with 4.8), valgrind shows: ==11044== 1 bytes in 1 blocks are definitely lost in loss record 2 of 2 ==11044== at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==11044== by 0x40102F: d_vect_bld_x.3431 (test_leak.f90:23) ==11044== by 0x400EA3: MAIN__ (test_leak.f90:16) ==11044== by 0x401096: main (test_leak.f90:14)