[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gfortran.dg / do_subscript_1.f90
bloba4b5058d67f5b225ee927120b40f3adc914827ae
1 ! { dg-do compile }
2 program main
3 real, dimension(3) :: a
4 a = 42.
5 do i=-1,3,2 ! { dg-warning "out of bounds" }
6 a(i) = 0 ! { dg-warning "out of bounds \\(-1 < 1\\)" }
7 end do
8 do i=4,1,-1 ! { dg-warning "out of bounds" }
9 a(i) = 22 ! { dg-warning "out of bounds \\(4 > 3\\)" }
10 end do
11 do i=1,4 ! { dg-warning "out of bounds" }
12 a(i) = 32 ! { dg-warning "out of bounds \\(4 > 3\\)" }
13 end do
14 do i=3,0,-1 ! { dg-warning "out of bounds" }
15 a(i) = 12 ! { dg-warning "out of bounds \\(0 < 1\\)" }
16 end do
17 do i=-1,3
18 if (i>0) a(i) = a(i) + 1 ! No warning inside if
19 end do
20 do i=-1,4
21 select case(i)
22 case(1:3)
23 a(i) = -234 ! No warning inside select case
24 end select
25 end do
26 do i=1,3 ! { dg-warning "out of bounds" }
27 a(i+1) = a(i) ! { dg-warning "out of bounds \\(4 > 3\\)" }
28 a(i-1) = a(i) ! { dg-warning "out of bounds \\(0 < 1\\)" }
29 end do
30 do i=3,1,-1 ! { dg-warning "out of bounds" }
31 a(i) = a(i-1) ! { dg-warning "out of bounds \\(0 < 1\\)" }
32 a(i) = a(i+1) ! { dg-warning "out of bounds \\(4 > 3\\)" }
33 end do
34 do i=1,2 ! { dg-warning "out of bounds" }
35 a(i) = a(i*i) ! { dg-warning "out of bounds \\(4 > 3\\)" }
36 end do
37 do i=1,4,2
38 a(i) = a(i)*2 ! No error
39 end do
40 do i=1,4
41 if (i > 3) exit
42 a(i) = 33
43 end do
44 do i=0,3 ! { dg-warning "out of bounds \\(0 < 1\\)" }
45 a(i) = 13. ! { dg-warning "out of bounds \\(0 < 1\\)" }
46 if (i < 1) exit
47 end do
48 do i=0,3
49 if (i < 1) cycle
50 a(i) = -21.
51 end do
52 do i=0,3 ! { dg-warning "out of bounds \\(0 < 1\\)" }
53 do j=1,2
54 a(i) = -123 ! { dg-warning "out of bounds \\(0 < 1\\)" }
55 end do
56 end do
57 end program main