The following program should print "1", "2". It does so with ifort but with gfortran it prints "1", "0".
type t integer :: i end type t type, extends(t) :: t2 integer :: j end type t2 class(t), allocatable :: a allocate(a, source=t2(1,2)) print *,a%i if(a%i /= 1) call abort() select type (a) type is (t2) print *,a%j if(a%j /= 2) call abort() end select end The dump shows that the type is wrong for the assignment: { struct t2 D.1377; struct t2 t2.0; t2.0.t.i = 1; t2.0.j = 2; D.1377 = t2.0; *a.$data = VIEW_CONVERT_EXPR<struct t>(D.1377); } -- Summary: [OOP] ALLOCATE SOURCE= does not properly copy the value from SOURCE Product: gcc Version: 4.5.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41714