view gcc/testsuite/gfortran.dg/do_check_3.f90 @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 04ced10e8804
children
line wrap: on
line source

! { 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" }