summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/do_check_2.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/do_check_2.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/do_check_2.f9020
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/do_check_2.f90 b/gcc/testsuite/gfortran.dg/do_check_2.f90
new file mode 100644
index 000000000..c40760d25
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/do_check_2.f90
@@ -0,0 +1,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" }