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 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: Sat, 17 Jan 2015 16:25:56 +0000
- Subject: [Bug fortran/60922] [4.9/5 regression] Memory leak with 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
----------------------------------------------------------------------------
Summary|[4.9/5 regression] Memory |[4.9/5 regression] Memory
|leak with INTENT(OUT) CLASS |leak with allocatable CLASS
|argument w/ allocatable |components
|CLASS components |
--- Comment #8 from janus at gcc dot gnu.org ---
As comment 7 shows, the problem is not specific to intent(out) arguments but
can occur also in other contexts where deallocation/finalization should occur.
The following test case demonstrates the same leak with an auto-deallocated
local variable (again leaks with 4.9 and trunk, but not 4.8):
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
call test()
contains
subroutine test()
class(d_vect_type), allocatable :: x
allocate(x)
allocate(x%v)
print *,"allocated!"
end subroutine
end