Debian Codegraph @

gcc/testsuite/gfortran.dg/bound_11.f90

raw
1 ! { dg-do run }
2 !
3 ! PR fortran/112371
4 ! The library used to incorrectly set an extent of zero for the first
5 ! dimension of the resulting array of a reduction function if that array was
6 ! empty.
7
8 program p
9 implicit none
10 call check_iparity
11 call check_sum
12 call check_minloc_int
13 call check_minloc_char
14 call check_maxloc_char4
15 call check_minval_char
16 call check_maxval_char4
17 call check_any
18 call check_count4
19 call check_findloc_int
20 call check_findloc_char
21 contains
22 subroutine check_iparity
23 integer :: a(9,3,0,7)
24 logical :: m1(9,3,0,7)
25 logical(kind=4) :: m4
26 integer :: i
27 integer, allocatable :: r(:,:,:)
28 a = reshape((/ integer:: /), shape(a))
29 m1 = reshape((/ logical:: /), shape(m1))
30 m4 = .false.
31 i = 1
32 r = iparity(a, dim=i)
33 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 111
34 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 112
35 i = 2
36 r = iparity(a, dim=i)
37 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 113
38 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 114
39 i = 3
40 r = iparity(a, dim=i)
41 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 115
42 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 116
43 i = 4
44 r = iparity(a, dim=i)
45 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 117
46 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 118
47 i = 1
48 r = iparity(a, dim=i, mask=m1)
49 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 121
50 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 122
51 i = 2
52 r = iparity(a, dim=i, mask=m1)
53 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 123
54 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 124
55 i = 3
56 r = iparity(a, dim=i, mask=m1)
57 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 125
58 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 126
59 i = 4
60 r = iparity(a, dim=i, mask=m1)
61 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 127
62 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 128
63 i = 1
64 r = iparity(a, dim=i, mask=m4)
65 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 131
66 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 132
67 i = 2
68 r = iparity(a, dim=i, mask=m4)
69 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 133
70 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 134
71 i = 3
72 r = iparity(a, dim=i, mask=m4)
73 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 135
74 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 136
75 i = 4
76 r = iparity(a, dim=i, mask=m4)
77 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 137
78 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 138
79 end subroutine
80 subroutine check_sum
81 integer :: a(9,3,0,7)
82 logical :: m1(9,3,0,7)
83 logical(kind=4) :: m4
84 integer :: i
85 integer, allocatable :: r(:,:,:)
86 a = reshape((/ integer:: /), shape(a))
87 m1 = reshape((/ logical:: /), shape(m1))
88 m4 = .false.
89 i = 1
90 r = sum(a, dim=i)
91 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 211
92 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 212
93 i = 2
94 r = sum(a, dim=i)
95 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 213
96 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 214
97 i = 3
98 r = sum(a, dim=i)
99 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 215
100 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 216
101 i = 4
102 r = sum(a, dim=i)
103 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 217
104 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 218
105 i = 1
106 r = sum(a, dim=i, mask=m1)
107 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 221
108 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 222
109 i = 2
110 r = sum(a, dim=i, mask=m1)
111 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 223
112 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 224
113 i = 3
114 r = sum(a, dim=i, mask=m1)
115 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 225
116 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 226
117 i = 4
118 r = sum(a, dim=i, mask=m1)
119 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 227
120 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 228
121 i = 1
122 r = sum(a, dim=i, mask=m4)
123 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 231
124 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 232
125 i = 2
126 r = sum(a, dim=i, mask=m4)
127 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 233
128 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 234
129 i = 3
130 r = sum(a, dim=i, mask=m4)
131 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 235
132 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 236
133 i = 4
134 r = sum(a, dim=i, mask=m4)
135 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 237
136 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 238
137 end subroutine
138 subroutine check_minloc_int
139 integer :: a(9,3,0,7)
140 logical :: m1(9,3,0,7)
141 logical(kind=4) :: m4
142 integer :: i
143 integer, allocatable :: r(:,:,:)
144 a = reshape((/ integer:: /), shape(a))
145 m1 = reshape((/ logical:: /), shape(m1))
146 m4 = .false.
147 i = 1
148 r = minloc(a, dim=i)
149 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 311
150 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 312
151 i = 2
152 r = minloc(a, dim=i)
153 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 313
154 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 314
155 i = 3
156 r = minloc(a, dim=i)
157 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 315
158 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 316
159 i = 4
160 r = minloc(a, dim=i)
161 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 317
162 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 318
163 i = 1
164 r = minloc(a, dim=i, mask=m1)
165 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 321
166 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 322
167 i = 2
168 r = minloc(a, dim=i, mask=m1)
169 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 323
170 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 324
171 i = 3
172 r = minloc(a, dim=i, mask=m1)
173 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 325
174 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 326
175 i = 4
176 r = minloc(a, dim=i, mask=m1)
177 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 327
178 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 328
179 i = 1
180 r = minloc(a, dim=i, mask=m4)
181 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 331
182 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 332
183 i = 2
184 r = minloc(a, dim=i, mask=m4)
185 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 333
186 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 334
187 i = 3
188 r = minloc(a, dim=i, mask=m4)
189 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 335
190 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 336
191 i = 4
192 r = minloc(a, dim=i, mask=m4)
193 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 337
194 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 338
195 end subroutine
196 subroutine check_minloc_char
197 character :: a(9,3,0,7)
198 logical :: m1(9,3,0,7)
199 logical(kind=4) :: m4
200 integer :: i
201 integer, allocatable :: r(:,:,:)
202 a = reshape((/ character:: /), shape(a))
203 m1 = reshape((/ logical:: /), shape(m1))
204 m4 = .false.
205 i = 1
206 r = minloc(a, dim=i)
207 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 411
208 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 412
209 i = 2
210 r = minloc(a, dim=i)
211 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 413
212 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 414
213 i = 3
214 r = minloc(a, dim=i)
215 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 415
216 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 416
217 i = 4
218 r = minloc(a, dim=i)
219 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 417
220 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 418
221 i = 1
222 r = minloc(a, dim=i, mask=m1)
223 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 421
224 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 422
225 i = 2
226 r = minloc(a, dim=i, mask=m1)
227 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 423
228 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 424
229 i = 3
230 r = minloc(a, dim=i, mask=m1)
231 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 425
232 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 426
233 i = 4
234 r = minloc(a, dim=i, mask=m1)
235 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 427
236 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 428
237 i = 1
238 r = minloc(a, dim=i, mask=m4)
239 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 431
240 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 432
241 i = 2
242 r = minloc(a, dim=i, mask=m4)
243 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 433
244 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 434
245 i = 3
246 r = minloc(a, dim=i, mask=m4)
247 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 435
248 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 436
249 i = 4
250 r = minloc(a, dim=i, mask=m4)
251 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 437
252 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 438
253 end subroutine
254 subroutine check_maxloc_char4
255 character(kind=4) :: a(9,3,0,7)
256 logical :: m1(9,3,0,7)
257 logical(kind=4) :: m4
258 integer :: i
259 integer, allocatable :: r(:,:,:)
260 a = reshape((/ character(kind=4):: /), shape(a))
261 m1 = reshape((/ logical:: /), shape(m1))
262 m4 = .false.
263 i = 1
264 r = maxloc(a, dim=i)
265 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 511
266 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 512
267 i = 2
268 r = maxloc(a, dim=i)
269 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 513
270 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 514
271 i = 3
272 r = maxloc(a, dim=i)
273 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 515
274 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 516
275 i = 4
276 r = maxloc(a, dim=i)
277 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 517
278 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 518
279 i = 1
280 r = maxloc(a, dim=i, mask=m1)
281 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 521
282 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 522
283 i = 2
284 r = maxloc(a, dim=i, mask=m1)
285 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 523
286 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 524
287 i = 3
288 r = maxloc(a, dim=i, mask=m1)
289 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 525
290 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 526
291 i = 4
292 r = maxloc(a, dim=i, mask=m1)
293 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 527
294 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 528
295 i = 1
296 r = maxloc(a, dim=i, mask=m4)
297 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 531
298 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 532
299 i = 2
300 r = maxloc(a, dim=i, mask=m4)
301 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 533
302 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 534
303 i = 3
304 r = maxloc(a, dim=i, mask=m4)
305 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 535
306 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 536
307 i = 4
308 r = maxloc(a, dim=i, mask=m4)
309 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 537
310 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 538
311 end subroutine
312 subroutine check_minval_char
313 character :: a(9,3,0,7)
314 logical :: m1(9,3,0,7)
315 logical(kind=4) :: m4
316 integer :: i
317 character, allocatable :: r(:,:,:)
318 a = reshape((/ character:: /), shape(a))
319 m1 = reshape((/ logical:: /), shape(m1))
320 m4 = .false.
321 i = 1
322 r = minval(a, dim=i)
323 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 611
324 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 612
325 i = 2
326 r = minval(a, dim=i)
327 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 613
328 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 614
329 i = 3
330 r = minval(a, dim=i)
331 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 615
332 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 616
333 i = 4
334 r = minval(a, dim=i)
335 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 617
336 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 618
337 i = 1
338 r = minval(a, dim=i, mask=m1)
339 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 621
340 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 622
341 i = 2
342 r = minval(a, dim=i, mask=m1)
343 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 623
344 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 624
345 i = 3
346 r = minval(a, dim=i, mask=m1)
347 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 625
348 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 626
349 i = 4
350 r = minval(a, dim=i, mask=m1)
351 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 627
352 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 628
353 i = 1
354 r = minval(a, dim=i, mask=m4)
355 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 631
356 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 632
357 i = 2
358 r = minval(a, dim=i, mask=m4)
359 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 633
360 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 634
361 i = 3
362 r = minval(a, dim=i, mask=m4)
363 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 635
364 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 636
365 i = 4
366 r = minval(a, dim=i, mask=m4)
367 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 637
368 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 638
369 end subroutine
370 subroutine check_maxval_char4
371 character(kind=4) :: a(9,3,0,7)
372 logical :: m1(9,3,0,7)
373 logical(kind=4) :: m4
374 integer :: i
375 character(kind=4), allocatable :: r(:,:,:)
376 a = reshape((/ character(kind=4):: /), shape(a))
377 m1 = reshape((/ logical:: /), shape(m1))
378 m4 = .false.
379 i = 1
380 r = maxval(a, dim=i)
381 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 711
382 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 712
383 i = 2
384 r = maxval(a, dim=i)
385 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 713
386 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 714
387 i = 3
388 r = maxval(a, dim=i)
389 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 715
390 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 716
391 i = 4
392 r = maxval(a, dim=i)
393 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 717
394 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 718
395 i = 1
396 r = maxval(a, dim=i, mask=m1)
397 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 721
398 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 722
399 i = 2
400 r = maxval(a, dim=i, mask=m1)
401 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 723
402 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 724
403 i = 3
404 r = maxval(a, dim=i, mask=m1)
405 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 725
406 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 726
407 i = 4
408 r = maxval(a, dim=i, mask=m1)
409 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 727
410 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 728
411 i = 1
412 r = maxval(a, dim=i, mask=m4)
413 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 731
414 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 732
415 i = 2
416 r = maxval(a, dim=i, mask=m4)
417 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 733
418 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 734
419 i = 3
420 r = maxval(a, dim=i, mask=m4)
421 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 735
422 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 736
423 i = 4
424 r = maxval(a, dim=i, mask=m4)
425 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 737
426 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 738
427 end subroutine
428 subroutine check_any
429 logical :: a(9,3,0,7)
430 integer :: i
431 logical, allocatable :: r(:,:,:)
432 a = reshape((/ logical:: /), shape(a))
433 i = 1
434 r = any(a, dim=i)
435 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 811
436 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 812
437 i = 2
438 r = any(a, dim=i)
439 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 813
440 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 814
441 i = 3
442 r = any(a, dim=i)
443 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 815
444 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 816
445 i = 4
446 r = any(a, dim=i)
447 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 817
448 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 818
449 end subroutine
450 subroutine check_count4
451 logical(kind=4) :: a(9,3,0,7)
452 integer :: i
453 integer, allocatable :: r(:,:,:)
454 a = reshape((/ logical(kind=4):: /), shape(a))
455 i = 1
456 r = count(a, dim=i)
457 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 911
458 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 912
459 i = 2
460 r = count(a, dim=i)
461 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 913
462 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 914
463 i = 3
464 r = count(a, dim=i)
465 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 915
466 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 916
467 i = 4
468 r = count(a, dim=i)
469 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 917
470 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 918
471 end subroutine
472 subroutine check_findloc_int
473 integer :: a(9,3,0,7)
474 logical :: m1(9,3,0,7)
475 logical(kind=4) :: m4
476 integer :: i
477 integer, allocatable :: r(:,:,:)
478 a = reshape((/ integer:: /), shape(a))
479 m1 = reshape((/ logical:: /), shape(m1))
480 m4 = .false.
481 i = 1
482 r = findloc(a, 10, dim=i)
483 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 1011
484 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 1012
485 i = 2
486 r = findloc(a, 10, dim=i)
487 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 1013
488 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 1014
489 i = 3
490 r = findloc(a, 10, dim=i)
491 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 1015
492 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 1016
493 i = 4
494 r = findloc(a, 10, dim=i)
495 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 1017
496 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 1018
497 i = 1
498 r = findloc(a, 10, dim=i, mask=m1)
499 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 1021
500 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 1022
501 i = 2
502 r = findloc(a, 10, dim=i, mask=m1)
503 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 1023
504 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 1024
505 i = 3
506 r = findloc(a, 10, dim=i, mask=m1)
507 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 1025
508 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 1026
509 i = 4
510 r = findloc(a, 10, dim=i, mask=m1)
511 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 1027
512 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 1028
513 i = 1
514 r = findloc(a, 10, dim=i, mask=m4)
515 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 1031
516 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 1032
517 i = 2
518 r = findloc(a, 10, dim=i, mask=m4)
519 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 1033
520 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 1034
521 i = 3
522 r = findloc(a, 10, dim=i, mask=m4)
523 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 1035
524 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 1036
525 i = 4
526 r = findloc(a, 10, dim=i, mask=m4)
527 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 1037
528 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 1038
529 end subroutine
530 subroutine check_findloc_char
531 character :: a(9,3,0,7)
532 logical :: m1(9,3,0,7)
533 logical(kind=4) :: m4
534 integer :: i
535 integer, allocatable :: r(:,:,:)
536 a = reshape((/ character:: /), shape(a))
537 m1 = reshape((/ logical:: /), shape(m1))
538 m4 = .false.
539 i = 1
540 r = findloc(a, "a", dim=i)
541 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 1111
542 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 1112
543 i = 2
544 r = findloc(a, "a", dim=i)
545 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 1113
546 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 1114
547 i = 3
548 r = findloc(a, "a", dim=i)
549 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 1115
550 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 1116
551 i = 4
552 r = findloc(a, "a", dim=i)
553 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 1117
554 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 1118
555 i = 1
556 r = findloc(a, "a", dim=i, mask=m1)
557 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 1121
558 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 1122
559 i = 2
560 r = findloc(a, "a", dim=i, mask=m1)
561 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 1123
562 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 1124
563 i = 3
564 r = findloc(a, "a", dim=i, mask=m1)
565 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 1125
566 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 1126
567 i = 4
568 r = findloc(a, "a", dim=i, mask=m1)
569 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 1127
570 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 1128
571 i = 1
572 r = findloc(a, "a", dim=i, mask=m4)
573 if (any(shape(r) /= (/ 3, 0, 7 /))) stop 1131
574 if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 1132
575 i = 2
576 r = findloc(a, "a", dim=i, mask=m4)
577 if (any(shape(r) /= (/ 9, 0, 7 /))) stop 1133
578 if (any(ubound(r) /= (/ 9, 0, 7 /))) stop 1134
579 i = 3
580 r = findloc(a, "a", dim=i, mask=m4)
581 if (any(shape(r) /= (/ 9, 3, 7 /))) stop 1135
582 if (any(ubound(r) /= (/ 9, 3, 7 /))) stop 1136
583 i = 4
584 r = findloc(a, "a", dim=i, mask=m4)
585 if (any(shape(r) /= (/ 9, 3, 0 /))) stop 1137
586 if (any(ubound(r) /= (/ 9, 3, 0 /))) stop 1138
587 end subroutine
588 end program