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

type-bound procedures with external subroutine argument

elwong
Beginner
490 Views
Hi,

When I compile the attached code with ifort12.1.0, I get the error:

test.f90(32): error #8382: The dummy arguments of an overriding and overridden binding that correspond by position must have the same names. [TESTMOD0^EXT]
procedure :: init => t1init
^
compilation aborted for test.f90 (code 1)

I normally use gfortran4.6.2 and it's never complained about this sort of thing, so I've assumed it's legal. Seems like ifort names the external subroutine with the name of the module so it appears different in the two modules.

Any help would be appreciated. Thanks

------------------------------------------------
subroutine ext ( i )
integer, intent(out) :: i
i = 0
end subroutine ext


module testMod0

type :: t0
integer :: i0
contains
procedure :: init
end type t0

contains

subroutine init ( myT, ext )
class(t0) :: myT
procedure() :: ext
write(6,*) ' 10 '
end subroutine init

end module testMod0


module testMod1
use testMod0, only : t0

type, extends(t0) :: t1
integer :: i1
contains
procedure :: init => t1init
end type t1

contains

subroutine t1init ( myT, ext )
class(t1 ) :: myT
procedure() :: ext
write(6,*) ' 20 '
end subroutine t1init

end module testMod1


0 Kudos
3 Replies
Steven_L_Intel1
Employee
490 Views
Thanks for the nice test case. I can reproduce the problem and it is indeed a bug in ifort. I have escalated this as issue DPD200176430. It appears to be triggered by having a procedure (or external) as an argument to the type-bound procedure, and having the ONLY clause. If you remove the ONLY on the use of testMod0, it compiles ok.
0 Kudos
elwong
Beginner
490 Views
Thanks for the reply. It's good to know that removing the only will make it compile. I was worried I'd have to make some major change to my code to get it to work with ifort.
0 Kudos
Steven_L_Intel1
Employee
490 Views
I expect this problem to be fixed in Update 9.
0 Kudos
Reply