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

Invalid "error #6285: There is no matching specific subroutine .." for a generic interface to a subprogram with MODULE keyword

FortranFan
Honored Contributor II
747 Views

Fyi to readers on a support incident submitted at the Intel Online Service Center: Intel Fortran compiler 18.0 Update 2 generates an invalid error for the following code involving a generic interface to a subprogram with the MODULE keyword.

C:\Temp>type m.f90
module m
   interface
      module subroutine sub()
      end subroutine sub
   end interface
   interface genfoo
      module subroutine foo( k )
         integer, intent(in) :: k(:)
      end subroutine
   end interface
end module
submodule(m) sm
contains
   module subroutine sub()
      integer :: k(1)
      call genfoo( k )
   end subroutine sub
   module subroutine foo( k )
      integer, intent(in) :: k(:)
      print *, k
   end subroutine foo
end submodule

C:\Temp>ifort /standard-semantics /warn:all /stand m.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R
) 64, Version 18.0.2.185 Build 20180210
Copyright (C) 1985-2018 Intel Corporation.  All rights reserved.

m.f90(16): error #6285: There is no matching specific subroutine for this generi
c subroutine call.   [GENFOO]
      call genfoo( k )
-----------^
compilation aborted for m.f90 (code 1)

C:\Temp>

 

0 Kudos
4 Replies
jimdempseyatthecove
Honored Contributor III
747 Views

FF,

What happens if you separate the module and submodule into two files (and make the submodule dependent on the module).?

Jim Dempsey

0 Kudos
FortranFan
Honored Contributor II
747 Views

jimdempseyatthecove wrote:

FF,

What happens if you separate the module and submodule into two files (and make the submodule dependent on the module).?

Jim Dempsey

Jim,

Thanks for your interest.  Per the output information shown below, separating the two program units into separate files doesn't make a difference i.e., assuming I understood your question correctly:

C:\Temp>type m.f90
module m
   interface
      module subroutine sub()
      end subroutine sub
   end interface
   interface genfoo
      module subroutine foo( k )
         integer, intent(in) :: k(:)
      end subroutine
   end interface
end module

C:\Temp>ifort /c /standard-semantics /warn:all /stand m.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R
) 64, Version 18.0.2.185 Build 20180210
Copyright (C) 1985-2018 Intel Corporation.  All rights reserved.


C:\Temp>type sm.f90
submodule(m) sm
contains
   module subroutine sub()
      integer :: k(1)
      call genfoo( k )
   end subroutine sub
   module subroutine foo( k )
      integer, intent(in) :: k(:)
      print *, k
   end subroutine foo
end submodule

C:\Temp>ifort /c /standard-semantics /warn:all /stand sm.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R
) 64, Version 18.0.2.185 Build 20180210
Copyright (C) 1985-2018 Intel Corporation.  All rights reserved.

sm.f90(5): error #6285: There is no matching specific subroutine for this generi
c subroutine call.   [GENFOO]
      call genfoo( k )
-----------^
compilation aborted for sm.f90 (code 1)

C:\Temp>

 

0 Kudos
FortranFan
Honored Contributor II
747 Views

jimdempseyatthecove wrote:

FF,

What happens if you separate the module and submodule into two files (and make the submodule dependent on the module).?

Jim Dempsey

Jim,

By the way, if no separate submodule implementation is chosen but rather it is just one program unit, then the compiler processes the code without errors:

C:\Temp>type m.f90
module m
   interface
      module subroutine sub()
      end subroutine sub
   end interface
   interface genfoo
      module subroutine foo( k )
         integer, intent(in) :: k(:)
      end subroutine
   end interface
contains
   module subroutine sub()
      integer :: k(1)
      call genfoo( k )
   end subroutine sub
   module subroutine foo( k )
      integer, intent(in) :: k(:)
      print *, k
   end subroutine foo
end module

C:\Temp>ifort /c /standard-semantics /warn:all /stand m.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R
) 64, Version 18.0.2.185 Build 20180210
Copyright (C) 1985-2018 Intel Corporation.  All rights reserved.


C:\Temp>

 

0 Kudos
FortranFan
Honored Contributor II
747 Views

Readers may note the compiler error in the original post appears to be with dummy arguments of rank greater than zero.  Shown below is a code variant with a dummy argument of rank zero which compiles without errors:

C:\Temp>type m.f90
module m
   interface
      module subroutine sub()
      end subroutine sub
   end interface
   interface genfoo
      module subroutine foo( k )
         integer, intent(in) :: k
      end subroutine
   end interface
end module
submodule(m) sm
contains
   module subroutine sub()
      integer :: k
      call genfoo( k )
   end subroutine sub
   module subroutine foo( k )
      integer, intent(in) :: k
      print *, k
   end subroutine foo
end submodule

C:\Temp>ifort /c /standard-semantics /warn:all /stand m.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R
) 64, Version 18.0.2.185 Build 20180210
Copyright (C) 1985-2018 Intel Corporation.  All rights reserved.


C:\Temp>

 

0 Kudos
Reply