- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Compiler: ifx (IFX) 2024.2.0 20240602 (ifx --version)
OS: Rocky Linux 8.9 (Green Obsidian)
I have a generic interface that the compiler does not like. Here is the source that produces the error.
! file: produce_error.f90
module CalculateModule
use, intrinsic :: iso_c_binding
implicit none
private
public :: calculate
interface calculate
module procedure :: calculate_standard
module procedure :: calculate_prealloc_standard
module procedure :: calculate_prealloc_pointer
module procedure :: calculate_pointer
end interface
interface
module subroutine calculate_standard(x1,x2,x3,opt_1,opt_2)
real(4), intent(in) :: x1(:), x2(:)
real(4), intent(inout), allocatable :: x3(:)
integer, intent(in), optional :: opt_1
type(c_ptr), intent(in), optional :: opt_2(3)
end subroutine
module subroutine calculate_pointer(x1,x2,x3,opt_1,opt_2)
real(4), intent(in) :: x1(:), x2(:)
real(4), intent(inout), pointer :: x3(:)
integer, intent(in), optional :: opt_1
type(c_ptr), intent(in), optional :: opt_2(3)
end subroutine
module subroutine calculate_prealloc_standard(x1,x2,x3,x1full,x2full,x3full,fx1,fx2,fx3,opt_1,opt_2)
real(4), intent(in) :: x1(:), x2(:)
real(4), intent(inout), allocatable :: x3(:)
complex(4), allocatable, intent(inout) :: x1full(:), x2full(:)
complex(4), allocatable, intent(inout) :: fx1(:), fx2(:), fx3(:)
complex(4), allocatable, intent(inout) :: x3full(:)
integer, intent(in), optional :: opt_1
type(c_ptr), intent(in), optional :: opt_2(3)
end subroutine
module subroutine calculate_prealloc_pointer(x1,x2,x3,x1full,x2full,x3full,fx1,fx2,fx3,opt_1,opt_2)
real(4), intent(in) :: x1(:), x2(:)
real(4), intent(inout), pointer :: x3(:)
complex(4), allocatable, intent(inout) :: x1full(:), x2full(:)
complex(4), allocatable, intent(inout) :: fx1(:), fx2(:), fx3(:)
complex(4), allocatable, intent(inout) :: x3full(:)
integer, intent(in), optional :: opt_1
type(c_ptr), intent(in), optional :: opt_2(3)
end subroutine
end interface
end module
Run the compiler and here is the output
ifx -c produce_error.f90
produce_error.f90(23): error #5286: Ambiguous generic interface CALCULATE: previously declared specific procedure CALCULATE_STANDARD is not distinguishable from this declaration. [CALCULATE_POINTER]
module subroutine calculate_pointer(x1,x2,x3,opt_1,opt_2)
--------------------------^
compilation aborted for produce_error.f90 (code 1)
Workaround
The strange thing is that reorganizing the items in the generic interface makes the compiler happy:
! BAD
interface calculate
module procedure :: calculate_standard
module procedure :: calculate_prealloc_standard
module procedure :: calculate_prealloc_pointer
module procedure :: calculate_pointer
end interface
! GOOD
interface calculate
module procedure :: calculate_standard
module procedure :: calculate_pointer
module procedure :: calculate_prealloc_standard
module procedure :: calculate_prealloc_pointer
end interface
I've attached the full workaround source.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much for the bug report and workaround. I have confirmed and escalated this case to our compiler engineering for a fix.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much for the bug report and workaround. I have confirmed and escalated this case to our compiler engineering for a fix.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just wanted to check in on the status of this issue. Using 2025.2.0, this issue is still present.
The ticket opened on my behalf under Intel support says "closed: final" and that happened back in the middle of Dec 2024. The ticket number is 06274816, created 2024/07/01 12:29, and last updated 2024/12/19 00:48. I wonder if this was an accidental batch closing of tickets because another ticket (# 06274814) was last updated at the exact same date and time. The interesting thing is that the issue addressed in ticket #06274814 works now, so I'm just not sure (https://community.intel.com/t5/Intel-Fortran-Compiler/Bug-Report-ICE-5623-passing-re-im-parts-of-complex-arrays-to/m-p/1610785)
Thanks!

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