Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

name conflicting compilation error

Zuodong_Y_
新手
1,708 檢視

The following code when compiled with ifort Version 2021.10.0 Build 20230609_000000 causes:

The name of the module procedure conflicts with a name in the encompassing scoping unit.

Is this a bug?

module a
	implicit none
	type t
		integer :: i(10)=1
	contains
		procedure :: f
	end type
	private :: f
contains
	subroutine f(self)
		class(t) :: self
		integer :: c(sum(self%i(:)))
	end subroutine
end module
module b
	use a
	implicit none
contains
	subroutine f()
	end subroutine
end module

 

 

7 回應
andrew_4619
榮譽貢獻者 III
1,672 檢視

Seems like a good and proper thing to me, that is why "use" had the only and renaming features.

Zuodong_Y_
新手
1,665 檢視

I think this should be valid as the subroutine "f" in module "a" is claimed as private.

FortranFan
榮譽貢獻者 III
1,656 檢視

@Zuodong_Y_ ,

It's a compiler issue that Intel Support team can work with you.  They may find this is already reported and there might be incident ticket on this already, and perhaps it's even fixed in a recent or forthcoming compiler update.

The problem has to do with how Intel packages the type-bound procedure binding.  Say the following will likely be processed ok (note I have not tested this) by the Intel compiler though this is not needed.

module a
	implicit none
	type t
		integer :: i(10)=1
	contains
		procedure :: f => t_f
	end type
	private :: t_f
contains
	subroutine t_f(self)
		class(t) :: self
		integer :: c(sum(self%i(:)))
	end subroutine
end module
module b
	use a
	implicit none
contains
	subroutine f()
	end subroutine
end module

 

Zuodong_Y_
新手
1,587 檢視

This workaround works. BTW, the issue also exist on Intel(R) 64, Version 2021.11.1 Build 20231117_000000

andrew_4619
榮譽貢獻者 III
1,579 檢視

FortranFan is always on the ball, I had neglected to spot the "private" attribute in my earlier comments..... doh!

Barbara_P_Intel
1,552 檢視

@Zuodong_Y_, thank you for reporting this erroneous error message. I filed a bug on your behalf, CMPLRLLVM-56427.

@FortranFan, thanks for the workaround! No magical fix in an upcoming compiler.

 

Devorah_H_Intel
405 檢視

This issue was fixed in ifx 2025.1 

Get Intel® oneAPI HPC Toolkit

回覆