| 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 <[email protected]> |
| 6 |
! |
| 7 |
module mod1 |
| 8 |
contains |
| 9 |
function eval (func, x1) |
| 10 |
real :: eval, func, x1 |
| 11 |
external :: func |
| 12 |
eval = func (x1) |
| 13 |
end function eval |
| 14 |
end module mod1 |
| 15 |
!------------------------------- |
| 16 |
module mod2 |
| 17 |
use mod1, only : eval |
| 18 |
real, external :: extfunc ! This was referenced as __mod2__extfunc__ |
| 19 |
contains |
| 20 |
|
| 21 |
subroutine foo (x0) |
| 22 |
real :: x0, x1 |
| 23 |
x1 = 42 |
| 24 |
x0 = eval (extfunc, x1) |
| 25 |
end subroutine foo |
| 26 |
|
| 27 |
end module mod2 |
| 28 |
!------------------------------- |
| 29 |
function extfunc (x) |
| 30 |
real, intent(in) :: x |
| 31 |
real :: extfunc |
| 32 |
extfunc = x |
| 33 |
end function extfunc |
| 34 |
!------------------------------- |
| 35 |
program gfcbug53 |
| 36 |
use mod2, only : foo |
| 37 |
real :: x0 = 0 |
| 38 |
call foo (x0) |
| 39 |
print *, x0 |
| 40 |
end program gfcbug53 |