https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65548
--- Comment #22 from Jürgen Reuter <juergen.reuter at desy dot de> --- One thing is: allocate (foo (0:this%dim-1), source=this%get_integral()) where this is some derived type with integer component dim and TBP get_integral which is a function generic :: get_integral => get_integral_array, get_integral_1 procedure :: get_integral_array procedure :: get_integral_1 subroutine get_integral_array (this, integral) class(t) :: this real, intent(out), dimension(:) :: integral integral = this%integral end subroutine get_integral_array subroutine get_integral_1 (this, integral) class(t) :: this real, intent(out) :: integral integral = this%integral(1) end subroutine get_integral_1