http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51864
Bug #: 51864 Summary: [OOP] ALLOCATE with polymorphic array constructor as SOURCE= Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org See also http://gcc.gnu.org/ml/fortran/2012-01/msg00147.html The following program causes gfortran to ICE with a segfault. The program compiles with NAG f95 5.1 and crayftn 7.1 - though it segfaults at run time. I think the program is valid F2003/F2008. type t integer :: i = 5 end type t type, extends(t) :: t2 integer :: j = 6 end type t2 class(t), allocatable :: a(:), b(:), c(:) allocate(t2 :: a(3)) allocate(t2 :: b(5)) !allocate(c, source=[ a, b ]) ! F2008, PR 44672 allocate(c(8), source=[ a, b ]) ! c = [ a, b ] ! F2008, PR 43366 select type(c) type is(t) print '(8(i2))', c%i type is(t2) print '(8(i2))', c%i print '(8(i2))', c%j end select end