1! { dg-do compile } 2! { dg-additional-options "-Wdo-subscript" } 3program main 4 real, dimension(3) :: a 5 a = 42. 6 do i=-1,3 ! { dg-warning "out of bounds \\(-1 < 1\\)" } 7 select case(i) 8 case(1:3) 9 a(i) = -234 ! { dg-warning "out of bounds \\(-1 < 1\\)" } 10 end select 11 end do 12 do i=1,4,2 13 a(i) = a(i)*2 ! No warning - end value is 3 14 end do 15 do i=1,4 ! { dg-warning "out of bounds \\(4 > 3\\)" } 16 if (i > 3) exit 17 a(i) = 33 ! { dg-warning "out of bounds \\(4 > 3\\)" } 18 end do 19 do i=0,3 ! { dg-warning "out of bounds \\(0 < 1\\)" } 20 if (i < 1) cycle 21 a(i) = -21. ! { dg-warning "out of bounds \\(0 < 1\\)" } 22 end do 23end program main 24