1! { dg-do compile }
2! Tests the for PR30410, in which the reference to extfunc would
3! be incorrectly made to the module namespace.
4!
5! Contributed by Harald Anlauf <anlauf@gmx.de>
6!
7module mod1
8contains
9  function eval (func, x1)
10    real     :: eval, func, x1
11    external :: func
12    eval = func (x1)
13  end function eval
14end module mod1
15!-------------------------------
16module mod2
17  use mod1, only : eval
18  real, external :: extfunc     ! This was referenced as __mod2__extfunc__
19contains
20
21  subroutine foo (x0)
22    real :: x0, x1
23    x1 = 42
24    x0 = eval (extfunc, x1)
25  end subroutine foo
26
27end module mod2
28!-------------------------------
29function extfunc (x)
30  real, intent(in) ::  x
31  real             ::  extfunc
32  extfunc = x
33end function extfunc
34!-------------------------------
35program gfcbug53
36  use mod2, only : foo
37  real :: x0 = 0
38  call foo (x0)
39  print *, x0
40end program gfcbug53
41