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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |NEW
   Last reconfirmed|                            |2011.01.05 14:48:38
         Resolution|FIXED                       |
            Summary|[OOP] EXTENDS_TYPE_OF       |[OOP] EXTENDS_TYPE_OF
                   |returns the wrong result if |returns the wrong result
                   |the polymorphic variable is |for disassociated
                   |unallocated                 |polymorphic pointers
     Ever Confirmed|0                           |1

--- Comment #3 from janus at gcc dot gnu.org 2011-01-05 14:48:38 UTC ---
(In reply to comment #1)
> Note that r168505 is crucial here, which is the fix for PR47024 that I just
> committed a few hours ago, and which fixes this very issue ...

Anyway r168505 only fixed the issue for allocatables, not pointers! Therefore
the following variant indeed still gives the wrong output:


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

type(t1), target :: a1
type(t11), target :: a11
class(t1), pointer :: b1
class(t11), pointer :: b11

b1 => NULL()
b11 => NULL()

print *, extends_type_of(b1,a1)   ! T - currently, gfortran prints "F"
print *, extends_type_of(b11,a1)  ! T - currently, gfortran prints "F"
print *, extends_type_of(b11,a11) ! T - currently, gfortran prints "F"

b1 => a1
b11 => a11

print *, extends_type_of(b1,a1)   ! T
print *, extends_type_of(b11,a1)  ! T
print *, extends_type_of(b11,a11) ! T
end

Reply via email to