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/60922] [4.9/5 regression] Memory leak with allocatable CLASS components


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


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