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/46321] New: [OOP] Polymorphic deallocation


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46321

           Summary: [OOP] Polymorphic deallocation
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: janus@gcc.gnu.org


Follow-up to PR 46174 (comment #2). Test case:


implicit none

type t
end type t

type, extends(t) :: t2
 integer, allocatable :: all(:)
end type t2

class(t), allocatable :: a

allocate(t2 :: a)
select type(a)
 type is (t2)
   allocate(a%all(1000000))
end select
deallocate(a)
end


The deallocation occurs according to the declared type (not the dynamic type),
i.e. the allocatable components of t2 are not being deallocated.

Solution: Add a $free component to the vtab, which points to a deallocation
procedure.


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