This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/49466] New: Memory leak with assignment of extended derived types


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).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]