aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/do_check_4.f90
blob: 5b087e4dde33d955ae38f9a977170bb68f5e6fda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
! { dg-do run }
! { dg-options "-fcheck=do" }
! { dg-shouldfail "DO check" }
!
! PR fortran/34656
! Run-time check for modifing loop variables
!

module x
  integer :: i
contains
  SUBROUTINE do_something()
    IMPLICIT NONE
    DO i=1,10
    ENDDO
  END SUBROUTINE do_something
end module x

PROGRAM test
  use x
  IMPLICIT NONE
  DO i=1,100
     CALL do_something()
  ENDDO
end PROGRAM test

! { dg-output "Fortran runtime error: Loop variable has been modified" }