module test1 implicit none private public :: operator(.compare.) interface operator(.compare.) module procedure :: compare end interface operator(.compare.) contains function compare(var1, var2) implicit none logical :: compare integer(1), intent(in) :: var1 integer(1), intent(in) :: var2 compare = (var1 > var2) end function compare end module test1 module test2 implicit none private public :: operator(.compare.) interface operator(.compare.) module procedure :: compare end interface operator(.compare.) contains function compare(var1, var2) implicit none logical :: compare integer(2), intent(in) :: var1 integer(2), intent(in) :: var2 compare = var1 > var2 end function compare end module test2 module test implicit none private public :: sub interface module subroutine sub() end subroutine sub end interface end module test submodule(test) testsubmodule use test1, only: operator(.compare.) ! <---Attension! use test2, only: operator(.compare.) ! <---Attension! implicit none contains module procedure sub implicit none print*, 2_2 .compare. 4_2 end procedure sub end submodule testsubmodule program main use test implicit none call sub() end program main