https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121204
Bug ID: 121204 Summary: Explicit interfaces in module are incorrectly passed to submodule Product: gcc Version: 13.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: townsend at astro dot wisc.edu Target Milestone: --- I've run into what looks like a bug with interfaces and submodules. Here's a MWE: --- module test_m implicit none (type, external) interface module subroutine call_proc(proc) interface subroutine proc(a) real, intent(in) :: a(:) end subroutine proc end interface end subroutine call_proc end interface end module test_m submodule (test_m) test_sm implicit none (type, external) contains module procedure call_proc call proc([1.,2.,.3]) end procedure call_proc end submodule test_sm program test use test_m implicit none(type, external) call call_proc(print_proc) contains subroutine print_proc(a) real, intent(in) :: a(:) print *,SIZE(a) end subroutine print_proc end program test --- Compiled using default flags, on MacOS Sequoia, the output is "21", when it should be "3". Modifying the print statement in the main program to display the array "a" results in a segfault. My suspicion is that the explicit interface for the proc dummy argument of call_proc() is not being correctly exported from the test_m module to the test_sm submodule. This suspicion is supported by the fact that, if I copy the interface into test_sm, the problem goes away.