http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58410
--- Comment #3 from janus at gcc dot gnu.org --- Slightly reduced test case: module m implicit none type series real,allocatable :: a(:) end type contains function fun() type(series),allocatable :: fun(:) allocate(fun(0)) end function subroutine sub type(series),allocatable :: new(:) integer :: j do j=1,2 new = fun() end do end subroutine end module