PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / do_subscript_2.f90
blobefea428c7c7144d558d7bdaa103b5e6555e66fb0
1 ! { dg-do compile }
2 ! { dg-additional-options "-Wdo-subscript" }
3 program 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
23 end program main