| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! Test the fix for PR87127 in which the references to exfunc cause |
| 4 |
! the error "exfunc at (1) is not a function". |
| 5 |
! |
| 6 |
! Contributed by Gerhard Steinmetz <[email protected]> |
| 7 |
! |
| 8 |
function exfunc(i) |
| 9 |
implicit none |
| 10 |
integer :: exfunc,i |
| 11 |
exfunc = 2*i |
| 12 |
end function |
| 13 |
|
| 14 |
! contents of test.f90 |
| 15 |
program test |
| 16 |
implicit none |
| 17 |
integer :: exfunc,i |
| 18 |
integer,parameter :: array(2)=[6,7] |
| 19 |
associate(i=>array(2)) ! Original bug |
| 20 |
if (exfunc(i) .ne. 2*i) stop 1 |
| 21 |
end associate |
| 22 |
i = 99 |
| 23 |
call foo |
| 24 |
contains |
| 25 |
subroutine foo() ! Comment #3 |
| 26 |
if (exfunc(i) .ne. 2*i) stop 2 |
| 27 |
end subroutine foo |
| 28 |
end program |