[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / expr-errors06.f90
blob1168d410b9bd9c43d640af4a89c3124c6b8d9ea3
1 ! RUN: %python %S/test_errors.py %s %flang_fc1 -Werror
2 ! Check out-of-range subscripts
3 real a(10)
4 integer, parameter :: n(2) = [1, 2]
5 integer unknown
6 !ERROR: DATA statement designator 'a(0_8)' is out of range
7 !ERROR: DATA statement designator 'a(11_8)' is out of range
8 data a(0)/0./, a(10+1)/0./
9 !ERROR: Subscript 0 is less than lower bound 1 for dimension 1 of array
10 print *, a(0)
11 !ERROR: Subscript 0 is less than lower bound 1 for dimension 1 of array
12 print *, a(1-1)
13 !ERROR: Subscript 11 is greater than upper bound 10 for dimension 1 of array
14 print *, a(11)
15 !ERROR: Subscript 11 is greater than upper bound 10 for dimension 1 of array
16 print *, a(10+1)
17 !ERROR: Subscript value (0) is out of range on dimension 1 in reference to a constant array value
18 print *, n(0)
19 !ERROR: Subscript value (3) is out of range on dimension 1 in reference to a constant array value
20 print *, n(4-1)
21 print *, a(1:12:3) ! ok
22 !ERROR: Subscript 13 is greater than upper bound 10 for dimension 1 of array
23 print *, a(1:13:3)
24 print *, a(10:-1:-3) ! ok
25 !ERROR: Subscript -2 is less than lower bound 1 for dimension 1 of array
26 print *, a(10:-2:-3)
27 print *, a(-1:-2) ! empty section is ok
28 print *, a(0:11:-1) ! empty section is ok
29 !ERROR: Subscript 0 is less than lower bound 1 for dimension 1 of array
30 print *, a(0:0:unknown) ! lower==upper, can ignore stride
31 !ERROR: Subscript 11 is greater than upper bound 10 for dimension 1 of array
32 print *, a(11:11:unknown) ! lower==upper, can ignore stride
33 end