view gcc/testsuite/gfortran.dg/recursive_check_7.f90 @ 127:4c56639505ff

fix function.c and add CbC-example Makefile
author mir3636
date Wed, 11 Apr 2018 18:46:58 +0900
parents 04ced10e8804
children 84e7813d76e9
line wrap: on
line source

! { dg-do run }
! { dg-options "-fcheck=recursion" }
! { dg-shouldfail "Recursion check" }
!
! PR fortran/32626
! Recursion run-time check
!

subroutine NormalFunc()
end subroutine NormalFunc

recursive subroutine valid(x)
  logical :: x
  if(x) call sndValid()
  print *, 'OK'
end subroutine valid

subroutine sndValid()
  call valid(.false.)
end subroutine sndValid

subroutine invalid(x)
  logical :: x
  if(x) call sndInvalid()
  print *, 'BUG'
  call abort()
end subroutine invalid

subroutine sndInvalid()
  call invalid(.false.)
end subroutine sndInvalid

call valid(.true.)
call valid(.true.)
call NormalFunc()
call NormalFunc()
call invalid(.true.)
end

! { dg-output "Fortran runtime error: Recursive call to nonrecursive procedure 'invalid'" }