Debian Codegraph @

gcc/testsuite/gfortran.dg/do_check_3.f90

raw
1 ! { dg-do run }
2 ! { dg-options "-fcheck=do" }
3 ! { dg-shouldfail "DO check" }
4 !
5 ! PR fortran/34656
6 ! Run-time check for modifing loop variables
7 !
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" }