summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/external_procedures_4.f90
blob: 252bae580d12210c3eb2a1c04ebb5cebec5e81f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
! { dg-do run }
!
! Test the fix for PR87127 in which the references to exfunc cause
! the error "exfunc at (1) is not a function".
!
! Contributed by Gerhard Steinmetz  <gscfq@t-online.de>
!
function exfunc(i)
  implicit none
  integer :: exfunc,i
  exfunc = 2*i
end function

! contents of test.f90
program test
  implicit none
  integer :: exfunc,i
  integer,parameter :: array(2)=[6,7]
  associate(i=>array(2))            ! Original bug
    if (exfunc(i) .ne. 2*i) stop 1
  end associate
  i = 99
  call foo
contains
  subroutine foo()                  ! Comment #3
    if (exfunc(i) .ne. 2*i) stop 2
  end subroutine foo
end program