http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59941
--- Comment #5 from janus at gcc dot gnu.org --- Reduced test case: module tao_random_numbers integer, dimension(10), private :: s_buffer integer, private :: s_buffer_end = size (s_buffer) end module module beam_structures type :: smatrix_t end type type :: beam_structure_t type(smatrix_t), dimension(:), allocatable :: smatrix contains procedure :: get_smatrix end type contains function get_smatrix (beam_structure) result (smatrix) class(beam_structure_t), intent(in) :: beam_structure type(smatrix_t), dimension (size (beam_structure%smatrix)) :: smatrix end function end module module sf_circe1 use tao_random_numbers use beam_structures end module