There is a compilation issue occured when circular reference is employed. See the codes:
module test1
implicit none
integer, parameter :: a = 5
interface
module subroutine sub1()
end subroutine sub1
end interface
end module test1
submodule(test1) submodule1
use test2
implicit none
contains
module procedure sub1
implicit none
print*, b
end procedure sub1
end submodule submodule1
module test2
implicit none
integer, parameter :: b = 4
interface
module subroutine sub2()
end subroutine sub2
end interface
end module test2
submodule(test2) submodule2
use test1
implicit none
contains
module procedure sub2
implicit none
print*, a
end procedure sub2
end submodule submodule2
program main
use test1
use test2
!TO DO.
end program mainThe use association in submodules are permitted by the standard. An error shows up when compile for the first time:
error #7002: Error in opening the compiled module file. Check INCLUDE paths. [TEST2]
If then we compile it again without cleanning-up, the target assembly will be created successfully. So is it a compiler mistake ? Or how should I do to solve it ?