https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79485
Bug ID: 79485 Summary: Bind(c) and module procedure renaming causes wrong procedure to be called Product: gcc Version: 6.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: vladimir.fuka at gmail dot com Target Milestone: --- Reported at http://stackoverflow.com/questions/42189625/renaming-a-subroutine-in-a-fortran-module-when-using-iso-c-binding Related to bug77746 and bug66695. The following code finishes as expected in gfortran 4.8 and crashes due to stack overflow in 6.3 (and likely alredy in 4.9) because procedure `foo` in `fmod2` calls itself ad infinitum. module fmod1 contains subroutine foo(i) implicit none integer, intent(inout) :: i i=i+1 end subroutine foo end module fmod1 module fmod2 use iso_c_binding use fmod1, only : foo_first => foo contains subroutine foo(i) bind(c) implicit none integer, intent(inout) :: i i=i+2 call foo_first(i) end subroutine foo end module fmod2 use fmod2 call foo(i) end