- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear readers, I am seeking you for advice on passing internal procedures as actual arguments, which is a fortran 2008 feature supported by ifort 15.0. The following module does not compile in ifort 15.0, because
error #7069: The characteristics of the associated actual function result differ from the characteristics of the dummy function result. [NESTED] call with_dummy_function(nested) -----------------------------------------^ compilation aborted for test.f90 (code 1)
Here is the code:
module m implicit none abstract interface function dummy_function() logical :: dummy_function end function end interface contains subroutine host() call with_dummy_function(nested) contains function nested() logical :: nested nested = .true. end function end subroutine subroutine with_dummy_function(func) procedure(dummy_function), pointer, intent(in) :: func end subroutine end module
While I managed to compile and run the same code with ifort 14 (service packs .3 and .4 ), any tips on how to get this feature to work with ifort 15.0 are appreciated!
Best regards
Ferdinand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Escalated as issue DPD200370165. A workaround is to create a procedure pointer, assign the pointer to the internal procedure and pass the pointer. As a note of information, you should be using "abstract interface" for dummy_function.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The issue here is that you are passing an internal procedure to a procedure pointer. If the argument to with_dummy_function was just a procedure, not a procedure pointer, it works. I had at first thought that it was not allowable to use an internal procedure in this context, but on research I find that it is. I will escalate this to the developers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Escalated as issue DPD200370165. A workaround is to create a procedure pointer, assign the pointer to the internal procedure and pass the pointer. As a note of information, you should be using "abstract interface" for dummy_function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, Steve, for the prompt reply.
Indeed, dropping the pointer attribute
subroutine with_dummy_function(func) !procedure(dummy_function), pointer, intent(in) :: func procedure(dummy_function) :: func end subroutine
does work fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve Lionel (Intel) wrote:
Escalated as issue DPD200370165. A workaround is to create a procedure pointer, assign the pointer to the internal procedure and pass the pointer. As a note of information, you should be using "abstract interface" for dummy_function.
Thank you for the hint, I edited my code. I never fully understood where to use abstract - and where to use "normal" - interfaces. Probably I should always go with "abstract" in f2k code unless something breaks...
I implemented the workaround you suggested and it works well!
subroutine host() procedure(dummy_function), pointer :: nested_ptr nested_ptr => nested call with_dummy_function(nested_ptr) contains function nested() logical :: nested nested = .true. end function end subroutine subroutine with_dummy_function(func) procedure(dummy_function), pointer, intent(in) :: func end subroutine
Best regards
Ferdinand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's really simple - if you don't use "abstract", you are declaring an external procedure which is assumed to exist. With "abstract", you're just defining the interface.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I expect the problem to be fixed in Update 1 to Parallel Studio XE 2017. If it doesn't make that, then Update 2.

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