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: unassig...@gcc.gnu.org ReportedBy: towns...@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).