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

            Bug ID: 63553
           Summary: [OOP] Wrong code when assigning a CLASS to a TYPE
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org

>From https://gcc.gnu.org/ml/fortran/2014-10/msg00072.html

Gives with Cray's ftn:
 tm = cm 2*1
but with gfortran 5 the wrong:
 tm = cm    19967872           1


program toto
implicit none

type mother
integer :: i
end type mother
type,extends(mother) :: child
end type child

type(mother) :: tm
type(child) :: tc
class(mother),allocatable :: cm,cm2
class(child),allocatable :: cc

allocate(cm,cc)
tc%i=0
cc%i=2
tm%i=2
cm%i=1

tm=cm
print *,'tm = cm',tm%i,cm%i
end program

Reply via email to