The same named entity from different modules and/or program units cannot be referenced: bug?

I am having the following issue while trying to build Fortran Package Manager with ifx with a recent update:

<ERROR> Compilation failed for object " src_fpm_settings.f90.o "
STOP 1
/tmp/ifx1633921843HhfFCb/ifxrJzAnL.i90: error #6405: The same named entity from different modules and/or program units cannot be referenced.   [TTABLE]

I believe this is the same error that @everythingfunctional has recently filed at the Intel Compiler Forum.

Can I ask the Intel gurus on this forum if you have any advice on how to move forward with this issue?

  • The failing build process can be seen here
  • The fpm_settings.f90 source can be seen here: I have also tried to relabel the toml_table variable to ttable => toml_table, but the compilation still crashes.

If this turns out to be a compiler bug, then, also ideas to work around this issue would be higly appreciated!

Thanks for any help.

Here is a guess about your problem. For a code where two modules define the same subroutine display

module date_ymd_mod
implicit none
type date_ymd
   integer :: year, month, day
end type date_ymd
contains
subroutine display(date)
type(date_ymd), intent(in) :: date
print "(i4.4,2('-',i2.2))", date
end subroutine display
end module date_ymd_mod
!
module date_ym_mod
implicit none
type date_ym
   integer :: year, month
end type date_ym
contains
subroutine display(date)
type(date_ym), intent(in) :: date
print "(i4.4,'-',i2.2)", date
end subroutine display
end module date_ym_mod
!
program main
use date_ymd_mod
use date_ym_mod
implicit none
call display(date_ymd(2024,2,10))
call display(date_ym(2024,2))
end program main

ifx correctly complains

display.f90(29): error #6405: The same named entity from different modules and/or program units cannot be referenced.   [DISPLAY]
call display(date_ymd(2024,2,10))
-----^
display.f90(30): error #6405: The same named entity from different modules and/or program units cannot be referenced.   [DISPLAY]
call display(date_ym(2024,2))
-----^
compilation aborted for display.f90 (code 1)

but when two modules have an interface for display ifx and gfortran accept the code:

module date_ymd_mod
implicit none
type date_ymd
   integer :: year, month, day
end type date_ymd
interface display
   module procedure display_ymd
end interface display
contains
subroutine display_ymd(date)
type(date_ymd), intent(in) :: date
print "(i4.4,2('-',i2.2))", date
end subroutine display_ymd
end module date_ymd_mod
!
module date_ym_mod
implicit none
type date_ym
   integer :: year, month
end type date_ym
interface display
   module procedure display_ym
end interface display
contains
subroutine display_ym(date)
type(date_ym), intent(in) :: date
print "(i4.4,'-',i2.2)", date
end subroutine display_ym
end module date_ym_mod
!
program main
use date_ymd_mod
use date_ym_mod
implicit none
call display(date_ymd(2024,2,10))
call display(date_ym(2024,2))
end program main

Output:

2024-02-10
2024-02

Thank you for the hint @Beliavsky.

In our case, toml_table is a derived type, and nowhere else is any procedure or variable, or anything defined with the same name. All that I could try to do was to locally rename it using

use fpm_toml, only: ttable=>toml_table

but the error message does not go away, it now points to [TTABLE].

It is a bug in ifx. the bug ID is CMPLRLLVM-52315. You can track it on this thread on the Intel Forum.

2 Likes

Thanks a lot @greenrongreen.

Not sure if would be useful, but the single-file version of fpm could be used as a reproducer for the issue. Looking forward to the fix!

1 Like