2 ! { dg-additional-options "-fcoarray=single -fdump-tree-original" }
4 ! Check that {L,U}{,CO}BOUND intrinsics are properly simplified.
12 type(t
) :: d(3:8) = t(7)
13 type(t
) :: e
[5:9,-1:*]
14 type(t
) :: h(3), j(4), k(0)
16 !Test full arrays vs subarrays
17 if (lbound(d
, 1) /= 3) call abort
18 if (lbound(d(3:5), 1) /= 1) call abort
19 if (lbound(d
%c
, 1) /= 1) call abort
20 if (ubound(d
, 1) /= 8) call abort
21 if (ubound(d(3:5), 1) /= 3) call abort
22 if (ubound(d
%c
, 1) /= 6) call abort
24 if (lcobound(e
, 1) /= 5) call abort
25 if (lcobound(e
%c
, 1) /= 5) call abort
26 if (lcobound(e
, 2) /= -1) call abort
27 if (lcobound(e
%c
, 2) /= -1) call abort
28 if (ucobound(e
, 1) /= 9) call abort
29 if (ucobound(e
%c
, 1) /= 9) call abort
30 ! no simplification for ucobound(e{,%c}, dim=2)
32 if (any(lbound(d
) /= [3])) call abort
33 if (any(lbound(d(3:5)) /= [1])) call abort
34 if (any(lbound(d
%c
) /= [1])) call abort
35 if (any(ubound(d
) /= [8])) call abort
36 if (any(ubound(d(3:5)) /= [3])) call abort
37 if (any(ubound(d
%c
) /= [6])) call abort
39 if (any(lcobound(e
) /= [5, -1])) call abort
40 if (any(lcobound(e
%c
) /= [5, -1])) call abort
41 ! no simplification for ucobound(e{,%c})
43 call test_empty_arrays(h
, j
, k
)
46 subroutine test_empty_arrays(a
, c
, d
)
47 type(t
) :: a(:), c(-3:0), d(3:1)
48 type(t
) :: f(4:2), g(0:6)
50 if (lbound(a
, 1) /= 1) call abort
51 if (lbound(c
, 1) /= -3) call abort
52 if (lbound(d
, 1) /= 1) call abort
53 if (lbound(f
, 1) /= 1) call abort
54 if (lbound(g
, 1) /= 0) call abort
56 if (ubound(c
, 1) /= 0) call abort
57 if (ubound(d
, 1) /= 0) call abort
58 if (ubound(f
, 1) /= 0) call abort
59 if (ubound(g
, 1) /= 6) call abort
61 if (any(lbound(a
) /= [ 1])) call abort
62 if (any(lbound(c
) /= [-3])) call abort
63 if (any(lbound(d
) /= [ 1])) call abort
64 if (any(lbound(f
) /= [ 1])) call abort
65 if (any(lbound(g
) /= [ 0])) call abort
67 if (any(ubound(c
) /= [0])) call abort
68 if (any(ubound(d
) /= [0])) call abort
69 if (any(ubound(f
) /= [0])) call abort
70 if (any(ubound(g
) /= [6])) call abort
74 ! { dg-final { scan-tree-dump-not "abort" "original" } }