PR target/83368
[official-gcc.git] / gcc / testsuite / gfortran.dg / do_check_3.f90
blob15086c20a132a5d4cf766cff8e7ee678c8e1f425
1 ! { dg-do run }
2 ! { dg-options "-fcheck=do" }
3 ! { dg-shouldfail "DO check" }
5 ! PR fortran/34656
6 ! Run-time check for modifing loop variables
8 program test
9 implicit none
10 real :: i, j, k
11 j = 10.0
12 k = 1.0
13 do i = 1.0, j, k ! { dg-warning "must be integer" }
14 call modLoopVar(i)
15 end do
16 contains
17 subroutine modLoopVar(x)
18 real :: x
19 x = x + 1
20 end subroutine modLoopVar
21 end program test
22 ! { dg-output "Fortran runtime error: Loop variable has been modified" }