[Bug fortran/66227] New: [OOP] EXTENDS_TYPE_OF n returns wrong result for polymorphic variable allocated to extended type

patnel97269-gfortran at yahoo dot fr gcc-bugzilla@gcc.gnu.org
Wed May 20 19:57:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66227

            Bug ID: 66227
           Summary: [OOP] EXTENDS_TYPE_OF n returns wrong result for
                    polymorphic variable allocated to extended type
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patnel97269-gfortran at yahoo dot fr
  Target Milestone: ---

Hi, 

The extends_type_of intrisic return the wrong value for the a polymorphic
variable allocated to a daughter class. See small code below. Code tested on
version 5.1.0 .

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

type(t1) a1
type(t11) a11
class(t1), allocatable :: b1,bb1
class(t11), allocatable :: b11


allocate(t11::b1)
print *, extends_type_of(b1,a11)   ! T
print *, extends_type_of(b1,a1)  ! T
deallocate(b1)
allocate(b1,source=a11)
print *, extends_type_of(b1,a11)   ! T
print *, extends_type_of(b1,a1)  ! T

allocate( b11,source=a11)
print *, extends_type_of(b11,a11)   ! T
print *, extends_type_of(b11,a1)  ! T

allocate( bb1,source=a1)
print *, extends_type_of(bb1,a11)   ! F
print *, extends_type_of(bb1,a1)  ! T
end



More information about the Gcc-bugs mailing list