aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/recursive_check_11.f90
blob: 870c1127d012cccc1697ba9b4814383a39e5c1ba (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 }
! { dg-options "-fcheck=recursion" }
! { dg-shouldfail "Recursion check" }
!
! { dg-output "Fortran runtime error: Recursive call to nonrecursive procedure 'f'" }
!
! PR fortran/39577
!
! wrong - recursion
program test
 integer :: i
 i = f(.false.)
 print *,i
 i = f(.true.)
 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