gcc/testsuite/gfortran.dg/pr93263_2.f90
raw| 1 | ! { dg-do run } |
| 2 | ! |
| 3 | ! Test contributed by Tobias Burnus <[email protected]> |
| 4 | |
| 5 | integer :: cnt |
| 6 | cnt = 0 |
| 7 | call sub() |
| 8 | if (cnt /= 5) stop 1 |
| 9 | contains |
| 10 | recursive subroutine sub() |
| 11 | save |
| 12 | logical :: first = .true. |
| 13 | integer :: i |
| 14 | cnt = cnt + 1 |
| 15 | if (first) then |
| 16 | first = .false. |
| 17 | i = 1 |
| 18 | end if |
| 19 | print *, "Hello", i |
| 20 | i = i + 1 |
| 21 | if (i <= 5) call sub() |
| 22 | end subroutine |
| 23 | end |
| 24 |