https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67760
--- Comment #4 from G. Steinmetz <gs...@t-online.de> --- Works with an explicit result variable : $ cat z2.f90 module m implicit none contains function f() result(z) integer :: z(4) call s contains subroutine s z = 42 end end end program p use m print *, f() end $ gfortran-9-20181021 z2.f90 $ a.out 42 42 42 42