https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84868
--- Comment #1 from G. Steinmetz <gs...@t-online.de> --- Works with different names (a, c) : $ cat z2.f90 module m character(:), allocatable :: a contains function f(n) result(z) character, parameter :: c(3) = ['x', 'y', 'z'] integer, intent(in) :: n character(len_trim(c(n))) :: z z = c(n) end end program p use m print *, f(2) end $ gfortran-8-20180311 z2.f90 -static-libgfortran $ a.out y