- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks - I have escalated this as issue DPD200361667.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just noticed that I made a copy/paste error in the OP; the argument to "gamma" was supposed to be "2.0". However, this is irrelevant in that you get the same internal compiler error either way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is fixed for a release later this year.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page