There is a weird error if you wrap an intrinsic function, then rename the wrapper in a use statement to have the same name as the original intrinsic. This is usually something that you would only do if you wanted to choose between your own implementation of a function and the compiler's. See here:
module wrap_gamma implicit none contains real function wrapper(x) real, intent(in) :: x wrapper = gamma(x) end function wrapper end module wrap_gamma program test_intrinsic_name_reuse use wrap_gamma, only: gamma => wrapper implicit none print *, gamma(2._r8) end program test_intrinsic_name_reuse
I found that this only happens if you actually use the intrinsic in the wrapper (e.g. no error if you remove the "wrapper = gamma(x)" line), and the issue also goes away if you use a generic function to create another alias (e.g. creating a "wrapper2" generic function and then aliasing gamma to that in the main program above). That second case is the workaround that I've been using.