This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/49466] New: Memory leak with assignment of extended derived types
- From: "townsend at astro dot wisc.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 19 Jun 2011 00:43:07 +0000
- Subject: [Bug fortran/49466] New: Memory leak with assignment of extended derived types
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49466
Summary: Memory leak with assignment of extended derived types
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: townsend@astro.wisc.edu
Created attachment 24558
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24558
Sample code reproducing the problem
I've encountered a severe memory leak in one of my codes, which I've been able
to trace back to an issue with the assignment of extended derived types
containing allocatable arrays.
It seems as though any allocatable components of the *parent* type are not
properly deallocated in a variable that appears on the lhs of an assignment
(whether default or defined).
In the attached sample code, which is a reduced test case from the full code,
the assignment "as_b = as_a" leaks memory from the U(:) allocatable component
(which is defined in state_t, the parent type), but not from the W(:)
allocatable component (which is defined in astate_t).