- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
my impression is that this is a problem with ifort (the code compiles with gfortran).
When compiling the attached code with ifort I get:
import-problem.f90(31): error #6484: Global entities may not be used as IMPORT-name entities [I_F]
import :: i_f
-------------^
import-problem.f90(34): error #8169: The specified interface is not declared. [I_F]
procedure(i_f), pointer, intent(in) :: p
-------------^
compilation aborted for import-problem.f90 (code 1)
ifort -V
Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20100414 Package ID: l_cprof_p_11.1.072
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.
module m1
implicit none
abstract interface
function i_f(x) result(y)
real, intent(in) :: x
real :: y
end function i_f
end interface
end module m1
module m2
use m1, only: i_f
implicit none
abstract interface
function i_g(x,p) result(y)
import :: i_f ! does not work
!use m1, only: i_f ! works fine
real, intent(in) :: x
procedure(i_f), pointer, intent(in) :: p
real :: y
end function i_g
end interface
end module m2
my impression is that this is a problem with ifort (the code compiles with gfortran).
When compiling the attached code with ifort I get:
import-problem.f90(31): error #6484: Global entities may not be used as IMPORT-name entities [I_F]
import :: i_f
-------------^
import-problem.f90(34): error #8169: The specified interface is not declared. [I_F]
procedure(i_f), pointer, intent(in) :: p
-------------^
compilation aborted for import-problem.f90 (code 1)
ifort -V
Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20100414 Package ID: l_cprof_p_11.1.072
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.
module m1
implicit none
abstract interface
function i_f(x) result(y)
real, intent(in) :: x
real :: y
end function i_f
end interface
end module m1
module m2
use m1, only: i_f
implicit none
abstract interface
function i_g(x,p) result(y)
import :: i_f ! does not work
!use m1, only: i_f ! works fine
real, intent(in) :: x
procedure(i_f), pointer, intent(in) :: p
real :: y
end function i_g
end interface
end module m2
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Seems like a bug related to the import statement itself ---hopefully, someone from Intel will confirm if it's indeed a compiler's bug.
As a workaround, use IMPORT statement without the import-name-list, e.g.:
[fortran]module m1 implicit none abstract interface function i_f(x) result(y) real, intent(in) :: x real :: y end function i_f end interface end module m1 module m2 use m1, only: i_f implicit none abstract interface function i_g(x,p) result(y) import real, intent(in) :: x procedure(i_f), pointer, intent(in) :: p real :: y end function i_g end interface end module m2[/fortran]
Funnily, in my case, gfortran is usually the one giving me trouble with abstract interfaces.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I confirmed this is a defect in the current 11.1 release that is corrected in the next major release that will be available later this year.
Sorry for the inconvenience. You will need to employ one of the two noted workarounds for now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
John, Kevin, thank you for the comments.
Good to know that there is a fix and that it's coming soon!
Regards,
Marco
Good to know that there is a fix and that it's coming soon!
Regards,
Marco
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page