summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/do_check_2.f90
blob: c40760d259869a8364a2b4d3e34e53185f81a582 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
! { dg-do run }
! { dg-options "-fcheck=do" }
! { dg-shouldfail "DO check" }
!
! PR fortran/34656
! Run-time check for modifing loop variables
!
program test
  implicit none
  integer :: i,j
  do i = 1, 10
    call modLoopVar(i)
  end do
contains
  subroutine modLoopVar(i)
    integer :: i
    i = i + 1
  end subroutine modLoopVar
end program test
! { dg-output "Fortran runtime error: Loop variable has been modified" }