Debian Codegraph @

gcc/testsuite/gfortran.dg/recursive_check_11.f90

raw
1 ! { dg-do run }
2 ! { dg-options "-fcheck=recursion" }
3 ! { dg-shouldfail "Recursion check" }
4 !
5 ! { dg-output "Fortran runtime error: Recursive call to nonrecursive procedure 'f'" }
6 !
7 ! PR fortran/39577
8 !
9 ! wrong - recursion
10 program test
11 integer :: i
12 i = f(.false.)
13 print *,i
14 i = f(.true.)
15 print *,i
16 contains
17 integer function f(rec)
18 logical :: rec
19 if(rec) then
20 f = g()
21 else
22 f = 42
23 end if
24 end function f
25 integer function g()
26 g = f(.false.)
27 end function g
28 end program test