2 ! { dg-options "-std=gnu" }
4 ! This file is here to check that LBOUND and UBOUND return correct values
6 ! Contributed by Francois-Xavier Coudert (coudert@clipper.ens.fr)
8 integer :: i(-1:1,-1:1) = 0
16 if (any(lbound(i(-1:1,-1:1)) /= 1)) STOP 1
17 if (lbound(i(-1:1,-1:1), 1) /= 1) STOP 2
18 if (lbound(i(-1:1,-1:1), 2) /= 1) STOP 3
20 if (any(ubound(i(-1:1,-1:1)) /= 3)) STOP 4
21 if (ubound(i(-1:1,-1:1), 1) /= 3) STOP 5
22 if (ubound(i(-1:1,-1:1), 2) /= 3) STOP 6
24 if (any(lbound(i(:,:)) /= 1)) STOP 7
25 if (lbound(i(:,:), 1) /= 1) STOP 8
26 if (lbound(i(:,:), 2) /= 1) STOP 9
28 if (any(ubound(i(:,:)) /= 3)) STOP 10
29 if (ubound(i(:,:), 1) /= 3) STOP 11
30 if (ubound(i(:,:), 2) /= 3) STOP 12
32 if (any(lbound(i(0:,-1:)) /= 1)) STOP 13
33 if (lbound(i(0:,-1:), 1) /= 1) STOP 14
34 if (lbound(i(0:,-1:), 2) /= 1) STOP 15
36 if (any(ubound(i(0:,-1:)) /= [2,3])) STOP 16
37 if (ubound(i(0:,-1:), 1) /= 2) STOP 17
38 if (ubound(i(0:,-1:), 2) /= 3) STOP 18
40 if (any(lbound(i(:0,:0)) /= 1)) STOP 19
41 if (lbound(i(:0,:0), 1) /= 1) STOP 20
42 if (lbound(i(:0,:0), 2) /= 1) STOP 21
44 if (any(ubound(i(:0,:0)) /= 2)) STOP 22
45 if (ubound(i(:0,:0), 1) /= 2) STOP 23
46 if (ubound(i(:0,:0), 2) /= 2) STOP 24
48 if (any(lbound(transpose(i
)) /= 1)) STOP 25
49 if (lbound(transpose(i
), 1) /= 1) STOP 26
50 if (lbound(transpose(i
), 2) /= 1) STOP 27
52 if (any(ubound(transpose(i
)) /= 3)) STOP 28
53 if (ubound(transpose(i
), 1) /= 3) STOP 29
54 if (ubound(transpose(i
), 2) /= 3) STOP 30
56 if (any(lbound(reshape(i
,[2,2])) /= 1)) STOP 31
57 if (lbound(reshape(i
,[2,2]), 1) /= 1) STOP 32
58 if (lbound(reshape(i
,[2,2]), 2) /= 1) STOP 33
60 if (any(ubound(reshape(i
,[2,2])) /= 2)) STOP 34
61 if (ubound(reshape(i
,[2,2]), 1) /= 2) STOP 35
62 if (ubound(reshape(i
,[2,2]), 2) /= 2) STOP 36
64 if (any(lbound(cshift(i
,-1)) /= 1)) STOP 37
65 if (lbound(cshift(i
,-1), 1) /= 1) STOP 38
66 if (lbound(cshift(i
,-1), 2) /= 1) STOP 39
68 if (any(ubound(cshift(i
,-1)) /= 3)) STOP 40
69 if (ubound(cshift(i
,-1), 1) /= 3) STOP 41
70 if (ubound(cshift(i
,-1), 2) /= 3) STOP 42
72 if (any(lbound(eoshift(i
,-1)) /= 1)) STOP 43
73 if (lbound(eoshift(i
,-1), 1) /= 1) STOP 44
74 if (lbound(eoshift(i
,-1), 2) /= 1) STOP 45
76 if (any(ubound(eoshift(i
,-1)) /= 3)) STOP 46
77 if (ubound(eoshift(i
,-1), 1) /= 3) STOP 47
78 if (ubound(eoshift(i
,-1), 2) /= 3) STOP 48
80 if (any(lbound(spread(i
,1,2)) /= 1)) STOP 49
81 if (lbound(spread(i
,1,2), 1) /= 1) STOP 50
82 if (lbound(spread(i
,1,2), 2) /= 1) STOP 51
84 if (any(ubound(spread(i
,1,2)) /= [2,3,3])) STOP 52
85 if (ubound(spread(i
,1,2), 1) /= 2) STOP 53
86 if (ubound(spread(i
,1,2), 2) /= 3) STOP 54
87 if (ubound(spread(i
,1,2), 3) /= 3) STOP 55
89 if (any(lbound(maxloc(i
)) /= 1)) STOP 56
90 if (lbound(maxloc(i
), 1) /= 1) STOP 57
92 if (any(ubound(maxloc(i
)) /= 2)) STOP 58
93 if (ubound(maxloc(i
), 1) /= 2) STOP 59
95 if (any(lbound(minloc(i
)) /= 1)) STOP 60
96 if (lbound(minloc(i
), 1) /= 1) STOP 61
98 if (any(ubound(minloc(i
)) /= 2)) STOP 62
99 if (ubound(minloc(i
), 1) /= 2) STOP 63
101 if (any(lbound(maxval(i
,2)) /= 1)) STOP 64
102 if (lbound(maxval(i
,2), 1) /= 1) STOP 65
104 if (any(ubound(maxval(i
,2)) /= 3)) STOP 66
105 if (ubound(maxval(i
,2), 1) /= 3) STOP 67
107 if (any(lbound(minval(i
,2)) /= 1)) STOP 68
108 if (lbound(minval(i
,2), 1) /= 1) STOP 69
110 if (any(ubound(minval(i
,2)) /= 3)) STOP 70
111 if (ubound(minval(i
,2), 1) /= 3) STOP 71
113 if (any(lbound(any(i
==1,2)) /= 1)) STOP 72
114 if (lbound(any(i
==1,2), 1) /= 1) STOP 73
116 if (any(ubound(any(i
==1,2)) /= 3)) STOP 74
117 if (ubound(any(i
==1,2), 1) /= 3) STOP 75
119 if (any(lbound(count(i
==1,2)) /= 1)) STOP 76
120 if (lbound(count(i
==1,2), 1) /= 1) STOP 77
122 if (any(ubound(count(i
==1,2)) /= 3)) STOP 78
123 if (ubound(count(i
==1,2), 1) /= 3) STOP 79
125 if (any(lbound(merge(i
,i
,.true
.)) /= 1)) STOP 80
126 if (lbound(merge(i
,i
,.true
.), 1) /= 1) STOP 81
127 if (lbound(merge(i
,i
,.true
.), 2) /= 1) STOP 82
129 if (any(ubound(merge(i
,i
,.true
.)) /= 3)) STOP 83
130 if (ubound(merge(i
,i
,.true
.), 1) /= 3) STOP 84
131 if (ubound(merge(i
,i
,.true
.), 2) /= 3) STOP 85
133 if (any(lbound(lbound(i
)) /= 1)) STOP 86
134 if (lbound(lbound(i
), 1) /= 1) STOP 87
136 if (any(ubound(lbound(i
)) /= 2)) STOP 88
137 if (ubound(lbound(i
), 1) /= 2) STOP 89
139 if (any(lbound(ubound(i
)) /= 1)) STOP 90
140 if (lbound(ubound(i
), 1) /= 1) STOP 91
142 if (any(ubound(ubound(i
)) /= 2)) STOP 92
143 if (ubound(ubound(i
), 1) /= 2) STOP 93
145 if (any(lbound(shape(i
)) /= 1)) STOP 94
146 if (lbound(shape(i
), 1) /= 1) STOP 95
148 if (any(ubound(shape(i
)) /= 2)) STOP 96
149 if (ubound(shape(i
), 1) /= 2) STOP 97
151 if (any(lbound(product(i
,2)) /= 1)) STOP 98
152 if (any(ubound(product(i
,2)) /= 3)) STOP 99
153 if (any(lbound(sum(i
,2)) /= 1)) STOP 100
154 if (any(ubound(sum(i
,2)) /= 3)) STOP 101
155 if (any(lbound(matmul(i
,i
)) /= 1)) STOP 102
156 if (any(ubound(matmul(i
,i
)) /= 3)) STOP 103
157 if (any(lbound(pack(i
,.true
.)) /= 1)) STOP 104
158 if (any(ubound(pack(i
,.true
.)) /= 9)) STOP 105
159 if (any(lbound(unpack(j
,[.true
.],[2])) /= 1)) STOP 106
160 if (any(ubound(unpack(j
,[.true
.],[2])) /= 1)) STOP 107
163 call sub1(reshape([7,9,4,6,7,9],[3,2]),3)
169 integer :: n
, a(2:n
+1,4:*)
171 if (any([lbound(a
,1), lbound(a
,2)] /= [2, 4])) STOP 108
172 if (any(lbound(a
) /= [2, 4])) STOP 109
176 integer :: x(3:2, 1:2)
178 if (size(x
) /= 0) STOP 110
179 if (lbound (x
, 1) /= 1 .or
. lbound(x
, 2) /= 1) STOP 111
180 if (any (lbound (x
) /= [1, 1])) STOP 112
181 if (ubound (x
, 1) /= 0 .or
. ubound(x
, 2) /= 2) STOP 113
182 if (any (ubound (x
) /= [0, 2])) STOP 114
186 integer :: x(4:5, 1:2)
188 if (size(x
) /= 0) STOP 115
189 if (lbound (x
, 1) /= 4 .or
. lbound(x
, 2) /= 1) STOP 116
190 if (any (lbound (x
) /= [4, 1])) STOP 117
191 if (ubound (x
, 1) /= 4 .or
. ubound(x
, 2) /= 2) STOP 118
192 if (any (ubound (x
) /= [4, 2])) STOP 119
197 integer :: x(7,n
,2,*)
199 if (ubound(x
,1) /= 7 .or
. ubound(x
,2) /= 4 .or
. ubound(x
,3) /= 2) STOP 120
202 subroutine jackal (b
, c
)
204 integer :: soda(b
:c
, 3:4)
207 if (size(soda
) /= 0) STOP 121
208 if (lbound (soda
, 1) /= 1 .or
. ubound (soda
, 1) /= 0) STOP 122
210 if (size(soda
) /= 2*(c
-b
+1)) STOP 123
211 if (lbound (soda
, 1) /= b
.or
. ubound (soda
, 1) /= c
) STOP 124
214 if (lbound (soda
, 2) /= 3 .or
. ubound (soda
, 2) /= 4) STOP 125
215 if (any (lbound (soda
) /= [lbound(soda
,1), lbound(soda
,2)])) STOP 126
216 if (any (ubound (soda
) /= [ubound(soda
,1), ubound(soda
,2)])) STOP 127
218 end subroutine jackal