- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
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
- Marcas:
- Intel® Fortran Compiler
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
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 copiado
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
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.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
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.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
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.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
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
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
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.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
I expect the problem to be fixed in Update 1 to Parallel Studio XE 2017. If it doesn't make that, then Update 2.

- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora