1! { dg-do run }
2! PR 79485 - used to crash because the wrong routine was called.
3module fmod1
4
5  contains
6
7  subroutine foo(i)
8    implicit none
9
10    integer, intent(inout) :: i
11
12    i=i+1
13
14  end subroutine foo
15
16end module fmod1
17
18module fmod2
19  use iso_c_binding
20  use fmod1, only : foo_first => foo
21
22  contains
23
24  subroutine foo(i) bind(c)
25    implicit none
26
27    integer, intent(inout) :: i
28
29    i=i+2
30    call foo_first(i)
31
32  end subroutine foo
33
34end module fmod2
35
36  use fmod2
37
38  call foo(i)
39end
40