summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/recursive_check_10.f90
blob: a30b82caaf2683d281beafa1e2cf4943ec8a9c10 (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
! { dg-do run }
! { dg-options "-fcheck=recursion" }
!
! PR fortran/39577
!
! OK - no recursion
program test
 integer :: i
 i = f(.false.)
 print *,i
 i = f(.false.)
 print *,i
contains
  integer function f(rec) 
    logical :: rec
    if(rec) then
      f = g()
    else
      f = 42
    end if
  end function f
  integer function g()
    g = f(.false.)
  end function g
end program test