aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pr93263_2.f90
blob: fd353c6b5484446923bfe2427b37361d9a578580 (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
! { dg-do run }
!
! Test contributed by Tobias Burnus  <burnus@gcc.gnu.org>

  integer :: cnt
  cnt = 0
  call sub()
  if (cnt /= 5) stop 1
contains
  recursive subroutine sub()
    save
    logical :: first = .true.
    integer :: i
    cnt = cnt + 1
    if (first) then
      first = .false.
      i = 1
    end if
    print *, "Hello", i
    i = i + 1
    if (i <= 5) call sub()
  end subroutine
end