aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/do_check_3.f90
blob: 15086c20a132a5d4cf766cff8e7ee678c8e1f425 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
! { 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
  real :: i, j, k
  j = 10.0
  k = 1.0
  do i = 1.0, j, k ! { dg-warning "must be integer" }
    call modLoopVar(i)
  end do
contains
  subroutine modLoopVar(x)
    real :: x
    x = x + 1
  end subroutine modLoopVar
end program test
! { dg-output "Fortran runtime error: Loop variable has been modified" }