[lldb] Fix "exact match" debug_names type queries (#118465)
[llvm-project.git] / flang / test / Semantics / expr-errors06.f90
blob07cda25e5cb0c4012f0a73c074f55c506d040646
1 ! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic -Werror
2 ! Check out-of-range subscripts
3 subroutine subr(da)
4 real a(10), da(2,1), empty(1:0,1)
5 integer, parameter :: n(2) = [1, 2]
6 integer unknown
7 !ERROR: DATA statement designator 'a(0_8)' is out of range
8 !ERROR: DATA statement designator 'a(11_8)' is out of range
9 data a(0)/0./, a(10+1)/0./
10 !ERROR: Subscript 0 is less than lower bound 1 for dimension 1 of array
11 print *, a(0)
12 !ERROR: Subscript 0 is less than lower bound 1 for dimension 1 of array
13 print *, a(1-1)
14 !ERROR: Subscript 11 is greater than upper bound 10 for dimension 1 of array
15 print *, a(11)
16 !ERROR: Subscript 11 is greater than upper bound 10 for dimension 1 of array
17 print *, a(10+1)
18 !ERROR: Subscript value (0) is out of range on dimension 1 in reference to a constant array value
19 print *, n(0)
20 !ERROR: Subscript value (3) is out of range on dimension 1 in reference to a constant array value
21 print *, n(4-1)
22 print *, a(1:12:3) ! ok
23 !ERROR: Subscript 13 is greater than upper bound 10 for dimension 1 of array
24 print *, a(1:13:3)
25 print *, a(10:-1:-3) ! ok
26 !ERROR: Subscript -2 is less than lower bound 1 for dimension 1 of array
27 print *, a(10:-2:-3)
28 print *, a(-1:-2) ! empty section is ok
29 print *, a(0:11:-1) ! empty section is ok
30 !ERROR: Subscript 0 is less than lower bound 1 for dimension 1 of array
31 print *, a(0:0:unknown) ! lower==upper, can ignore stride
32 !ERROR: Subscript 11 is greater than upper bound 10 for dimension 1 of array
33 print *, a(11:11:unknown) ! lower==upper, can ignore stride
34 !ERROR: Subscript 0 is less than lower bound 1 for dimension 1 of array
35 print *, da(0,1)
36 !ERROR: Subscript 3 is greater than upper bound 2 for dimension 1 of array
37 print *, da(3,1)
38 !ERROR: Subscript 0 is less than lower bound 1 for dimension 2 of array
39 print *, da(1,0)
40 !WARNING: Subscript 2 is greater than upper bound 1 for dimension 2 of array
41 print *, da(1,2)
42 print *, empty([(j,j=1,0)],1) ! ok
43 print *, empty(1:0,1) ! ok
44 print *, empty(:,1) ! ok
45 print *, empty(i:j,k) ! ok
46 !WARNING: Empty array dimension 1 should not be subscripted as an element or non-empty array section
47 print *, empty(i,1)
48 end