- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following code appears to be standard-conforming,
module container_module
use iso_fortran_env
integer, parameter :: lkc = logical_kinds(1)
integer, parameter :: ikc = integer_kinds(1)
type :: container_ik(kind)
integer , kind :: kind = integer_kinds(1)
integer(kind) :: value
end type
type :: container_lk(kind)
integer , kind :: kind = logical_kinds(1)
logical(kind) :: value
end type
end module
module disp_module
use container_module
type :: disp_type
end type
interface show
module subroutine show_logical(disp, object)
use container_module, only: container => container_lk
class(disp_type) , intent(inout) :: disp
!type(container_lk(lkc)) , intent(in) :: object
type(container(lkc)) , intent(in) :: object
end subroutine
module subroutine show_integer(disp, object)
use container_module, only: container => container_ik
class(disp_type) , intent(inout) :: disp
!type(container_ik(ikc)) , intent(in) :: object
type(container(ikc)) , intent(in) :: object
end subroutine
end interface
end module
end
but Intel ifort 2021.5 generates the following error,
error #5286: Ambiguous generic interface SHOW: previously declared specific procedure SHOW_LOGICAL is not distinguishable from this declaration. [SHOW_INTEGER]
module subroutine show_integer(disp, object)
----------------------^
The error however is incorrect because the two interfaces are different.
The issue appears to be with the renaming of the module entities within the interfaces to the same aliases ("container"). If we uncomment the commented lines to use the type names explicitly, then the error is resolved.
This appears to be a bug in ifort unless someone can explain the bizarre behavior observed above. For reference, gfortran is fine with both implementations. The code can be tested here with different ifort and other compilers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We're creating a bug report. Thank you for bringing this to our attention.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For whatever it's worth, I agree the code in the original post appears to conform to the Fortran standard.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We're creating a bug report. Thank you for bringing this to our attention.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The fix is scheduled for 2024.2 release of IFX, planned for July.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the fix!
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page