1! { dg-do run } 2! { dg-options "-fcheck=recursion" } 3! { dg-shouldfail "Recursion check" } 4! 5! PR fortran/32626 6! Recursion run-time check 7! 8 9subroutine NormalFunc() 10end subroutine NormalFunc 11 12recursive subroutine valid(x) 13 logical :: x 14 if(x) call sndValid() 15 print *, 'OK' 16end subroutine valid 17 18subroutine sndValid() 19 call valid(.false.) 20end subroutine sndValid 21 22subroutine invalid(x) 23 logical :: x 24 if(x) call sndInvalid() 25 print *, 'BUG' 26 STOP 1 27end subroutine invalid 28 29subroutine sndInvalid() 30 call invalid(.false.) 31end subroutine sndInvalid 32 33call valid(.true.) 34call valid(.true.) 35call NormalFunc() 36call NormalFunc() 37call invalid(.true.) 38end 39 40! { dg-output "Fortran runtime error: Recursive call to nonrecursive procedure 'invalid'" } 41