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

           Summary: [OOP] EXTENDS_TYPE_OF still returns the wrong result
                    if the polymorphic variable is unallocated
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org


Found when looking at PR 41580 -- and related to PR47180, PR47024 and PR47189.

The following programs works if "b1" was never allocated - and if it was last
allocated to "t1"; it fails if it was last allocated to "t11".

Thus, the vtab seems to be properly set initially; it also seems to be properly
set during allocation, but it does not seem to get reset for DEALLOCATE.


implicit none
type t1
  integer :: a
end type t1
type, extends(t1):: t11
  integer :: b
end type t11

class(t1), allocatable :: b1
class(t11), allocatable :: b11

allocate(t11 :: b1)
deallocate(b1)
if (extends_type_of(b1,b11) .neqv. .false.) call abort()
end

Reply via email to