https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77746
Tiziano Müller <dev-zero at gentoo dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dev-zero at gentoo dot org --- Comment #4 from Tiziano Müller <dev-zero at gentoo dot org> --- There is an even simpler reproducer and slightly different twist, but I suspect it's the same bug: test.c: void bar(); int main(int argc, char* argv[]) { bar(); return 0; } works as expected with any version with gcc and the following Fortran file: foo_c_standalone.f90: module foo_c use iso_c_binding contains subroutine bar() write(*,*) "bar" end subroutine c_bar() bind(C, name="bar") write(*,*) "c_bar" call bar() end end module while it terminates with a segfault due to the recursive call with gcc-5.3.1, gcc-7.3.0 (and probably also gcc-4.9+) but works with gcc-4.8.5 with the following code instead: foo_c.f90: module foo_c use iso_c_binding use foo contains subroutine c_bar() bind(C, name="bar") write(*,*) "c_bar" call bar() end end module foo.f90: module foo contains subroutine bar() write(*,*) "bar" end end