https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104630
Bug ID: 104630 Summary: module subroutine not accessible from submodule Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: neil.n.carlson at gmail dot com Target Milestone: --- Consider this minimal example. File module.f90: module modA private type, public :: typeA contains procedure :: foo end type interface module subroutine foo(this) class(typeA) :: this end subroutine end interface contains subroutine bar(this) type(typeA) :: this end subroutine end module File submodule.f90: submodule(modA) foo_impl contains module subroutine foo(this) class(typeA) :: this call bar(this) ! a module subroutine in the host module end subroutine end submodule File main.f90: use modA end The implementation of subroutine foo in the submodule should have access to subroutine bar defined in its host module but it apparently does not judging from the link error: $ gfortran module.f90 submodule.f90 main.f90 /usr/bin/ld: /tmp/ccEycu6t.o: in function `__moda_MOD_foo': gfortran-20220221-submodule.f90:(.text+0x17): undefined reference to `__moda_MOD_bar' collect2: error: ld returned 1 exit status If the 3 program units are combined into a single file, that will compile and link without error.