PR rtl-optimization/82913
[official-gcc.git] / gcc / testsuite / gfortran.dg / bounds_check_3.f90
blob5fb96b8dd2f322687d286c0840ec90bc857315ec
1 ! { dg-do compile }
2 integer,parameter :: n = 5, m = 8
3 integer a(10), i
5 print *, a(15:14) ! don't warn
6 print *, a(14:15) ! { dg-warning "is out of bounds" }
7 print *, a(-5:-6) ! don't warn
8 print *, a(-6:-5) ! { dg-warning "is out of bounds" }
9 print *, a(15:14:1) ! don't warn
10 print *, a(14:15:1) ! { dg-warning "is out of bounds" }
11 print *, a(-5:-6:1) ! don't warn
12 print *, a(-6:-5:1) ! { dg-warning "is out of bounds" }
13 print *, a(15:14:-1) ! { dg-warning "is out of bounds" }
14 print *, a(14:15:-1) ! don't warn
15 print *, a(-5:-6:-1) ! { dg-warning "is out of bounds" }
16 print *, a(-6:-5:-1) ! don't warn
18 print *, a(15:) ! don't warn
19 print *, a(15::-1) ! { dg-warning "is out of bounds" }
20 print *, a(-1:) ! { dg-warning "is out of bounds" }
21 print *, a(-1::-1) ! don't warn
22 print *, a(:-1) ! don't warn
23 print *, a(:-1:-1) ! { dg-warning "is out of bounds" }
24 print *, a(:11) ! { dg-warning "is out of bounds" }
25 print *, a(:11:-1) ! don't warn
27 print *, a(1:20:10) ! { dg-warning "is out of bounds" }
28 print *, a(1:15:15) ! don't warn
29 print *, a(1:16:15) ! { dg-warning "is out of bounds" }
30 print *, a(10:15:6) ! don't warn
31 print *, a(11:15:6) ! { dg-warning "is out of bounds" }
32 print *, a(11:-5:6) ! don't warn
34 print *, a(10:-8:-9) ! { dg-warning "is out of bounds" }
35 print *, a(10:-7:-9) ! don't warn
37 print *, a(0:0:-1) ! { dg-warning "is out of bounds" }
38 print *, a(0:0:1) ! { dg-warning "is out of bounds" }
39 print *, a(0:0) ! { dg-warning "is out of bounds" }
41 print *, a(1:15:i) ! don't warn
42 print *, a(1:15:n) ! { dg-warning "is out of bounds" }
43 print *, a(1:15:m) ! don't warn
45 print *, a(1:-5:-m) ! don't warn
46 print *, a(1:-5:-n) ! { dg-warning "is out of bounds" }
47 print *, a(1:-5:-i) ! don't warn
49 print *, a(-5:-5) ! { dg-warning "is out of bounds" }
50 print *, a(15:15) ! { dg-warning "is out of bounds" }
51 print *, a(-5:-5:1) ! { dg-warning "is out of bounds" }
52 print *, a(15:15:-1) ! { dg-warning "is out of bounds" }
53 print *, a(-5:-5:2) ! { dg-warning "is out of bounds" }
54 print *, a(15:15:-2) ! { dg-warning "is out of bounds" }
55 print *, a(-5:-5:n) ! { dg-warning "is out of bounds" }
56 print *, a(15:15:-n) ! { dg-warning "is out of bounds" }
57 print *, a(-5:-5:i) ! { dg-warning "is out of bounds" }
58 print *, a(15:15:-i) ! { dg-warning "is out of bounds" }
59 print *, a(5:5) ! don't warn
60 print *, a(5:5:1) ! don't warn
61 print *, a(5:5:-1) ! don't warn
62 print *, a(5:5:2) ! don't warn
63 print *, a(5:5:-2) ! don't warn
64 print *, a(5:5:n) ! don't warn
65 print *, a(5:5:-n) ! don't warn
66 print *, a(5:5:i) ! don't warn
67 print *, a(5:5:-i) ! don't warn
69 end