This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Copy class into type bug ?


Hi all, 


I have a weird result when trying to copy a polymorphic class object into a type variable. 

The simple test case is below, I'm using gfortran 4.9.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 



I got that as result : tm = cm    13410160           1 , instead of 1 1. 


Thanks.


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