This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/60922] [4.9/5 regression] Memory leak with INTENT(OUT) CLASS argument w/ allocatable CLASS components
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 16 Jan 2015 21:28:14 +0000
- Subject: [Bug fortran/60922] [4.9/5 regression] Memory leak with INTENT(OUT) CLASS argument w/ allocatable CLASS components
- Auto-submitted: auto-generated
- References: <bug-60922-4 at http dot gcc dot gnu dot org/bugzilla/>
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)