This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Copy class into type bug ?
- From: "patnel97269-gfortran at yahoo dot fr" <patnel97269-gfortran at yahoo dot fr>
- To: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Mon, 13 Oct 2014 15:29:41 +0100
- Subject: Copy class into type bug ?
- Authentication-results: sourceware.org; auth=none
- Reply-to: "patnel97269-gfortran at yahoo dot fr" <patnel97269-gfortran at yahoo dot fr>
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.