The attached code crashes when compiled with ifort 15.0 . The intended output should be (from a gfortran run)
$ ./test
T
1
T
1 2
module m1 implicit none type, abstract :: c_abs end type c_abs type, extends(c_abs) :: t_cnt class(c_abs), allocatable :: f end type t_cnt end module m1 !------------------------ module m2 use m1, only: c_abs, t_cnt implicit none type, extends(c_abs) :: t_a integer, allocatable :: i(:) end type t_a type, extends(c_abs) :: t_b integer :: ndata type(t_cnt), allocatable :: data(:) end type t_b contains pure function get_data(var) result(dat) class(t_b), intent(in) :: var type(t_cnt) :: dat(var%ndata) dat = var%data end function get_data end module m2 !------------------------ program p use m1 use m2 implicit none type(t_b) :: b type(t_cnt), allocatable :: cnt(:) b%ndata = 1 allocate( b%data( b%ndata ) ) allocate( t_a :: b%data(1)%f ) select type( a => b%data(1)%f ) type is(t_a) allocate( a%i(2) ) a%i = (/ 1 , 2 /) end select cnt = get_data( b ) write(*,*) allocated(cnt) write(*,*) size(cnt) write(*,*) allocated( cnt(1)%f ) select type( a => cnt(1)%f ) type is(t_a) write(*,*) a%i end select end program p