Debian Codegraph @

gcc/testsuite/gfortran.dg/maxloc_with_dim_and_mask_1.f90

raw
1 ! { dg-do run }
2 !
3 ! PR fortran/90608
4 ! Check the correct behaviour of the inline maxloc implementation,
5 ! when the dim and mask argument are present.
6
7 program p
8 implicit none
9 integer, parameter :: data60(*) = (/ 2, 5, 4, 6, 0, 9, 3, 5, 4, 4, &
10 1, 7, 3, 2, 1, 2, 5, 4, 6, 0, &
11 9, 3, 5, 4, 4, 1, 7, 3, 2, 1, &
12 2, 5, 4, 6, 0, 9, 3, 5, 4, 4, &
13 1, 7, 3, 2, 1, 2, 5, 4, 6, 0, &
14 9, 3, 5, 4, 4, 1, 7, 3, 2, 1 /)
15 logical, parameter :: mask60(*) = (/ .true. , .false., .false., .false., &
16 .true. , .false., .true. , .false., &
17 .false., .true. , .true. , .false., &
18 .true. , .true. , .true. , .true. , &
19 .false., .true. , .false., .true. , &
20 .false., .true. , .false., .true. , &
21 .true. , .false., .false., .true. , &
22 .true. , .true. , .true. , .false., &
23 .false., .false., .true. , .false., &
24 .true. , .false., .true. , .true. , &
25 .true. , .false., .true. , .true. , &
26 .false., .true. , .false., .true. , &
27 .false., .true. , .false., .false., &
28 .false., .true. , .true. , .true. , &
29 .false., .true. , .false., .true. /)
30 integer, parameter :: data1(*) = (/ 2, 3, 2, 3, &
31 1, 2, 3, 2, &
32 3, 1, 2, 3, &
33 2, 3, 1, 2, &
34 3, 2, 3, 1 /)
35 integer, parameter :: data2(*) = (/ 2, 1, 2, &
36 3, 2, 3, &
37 4, 3, 4, &
38 2, 1, 2, &
39 1, 2, 1 /)
40 integer, parameter :: data3(*) = (/ 5, 1, 5, &
41 1, 2, 1, &
42 2, 1, 2, &
43 3, 2, 3 /)
44 integer, parameter :: data1m(*) = (/ 1, 2, 1, 1, &
45 1, 3, 2, 3, &
46 1, 1, 1, 2, &
47 3, 1, 1, 3, &
48 2, 3, 1, 1 /)
49 integer, parameter :: data2m(*) = (/ 4, 4, 0, &
50 1, 1, 2, &
51 1, 2, 2, &
52 2, 3, 1, &
53 3, 3, 2 /)
54 integer, parameter :: data3m(*) = (/ 3, 2, 4, &
55 4, 3, 2, &
56 5, 4, 0, &
57 1, 1, 2 /)
58 call check_int_const_shape_rank_3
59 call check_int_const_shape_rank_3_true_mask
60 call check_int_const_shape_rank_3_false_mask
61 call check_int_const_shape_rank_3_optional_mask_present
62 call check_int_const_shape_rank_3_optional_mask_absent
63 call check_int_const_shape_empty_4
64 call check_int_alloc_rank_3
65 call check_int_alloc_rank_3_true_mask
66 call check_int_alloc_rank_3_false_mask
67 call check_int_alloc_empty_4
68 call check_real_const_shape_rank_3
69 call check_real_const_shape_rank_3_true_mask
70 call check_real_const_shape_rank_3_false_mask
71 call check_real_const_shape_rank_3_optional_mask_present
72 call check_real_const_shape_rank_3_optional_mask_absent
73 call check_real_const_shape_empty_4
74 call check_real_alloc_rank_3
75 call check_real_alloc_rank_3_true_mask
76 call check_real_alloc_rank_3_false_mask
77 call check_real_alloc_empty_4
78 call check_lower_bounds
79 call check_dependencies
80 contains
81 subroutine check_int_const_shape_rank_3()
82 integer :: a(3,4,5)
83 logical :: m(3,4,5)
84 integer, allocatable :: r(:,:)
85 a = reshape(data60, shape(a))
86 m = reshape(mask60, shape(m))
87 r = maxloc(a, dim = 1, mask = m)
88 if (any(shape(r) /= (/ 4, 5 /))) error stop 11
89 if (any(r /= reshape(data1m, (/ 4, 5 /)))) error stop 12
90 r = maxloc(a, dim = 2, mask = m)
91 if (any(shape(r) /= (/ 3, 5 /))) error stop 13
92 if (any(r /= reshape(data2m, (/ 3, 5 /)))) error stop 14
93 r = maxloc(a, dim = 3, mask = m)
94 if (any(shape(r) /= (/ 3, 4 /))) error stop 15
95 if (any(r /= reshape(data3m, (/ 3, 4 /)))) error stop 16
96 end subroutine
97 subroutine check_int_const_shape_rank_3_true_mask()
98 integer :: a(3,4,5)
99 integer, allocatable :: r(:,:)
100 a = reshape(data60, shape(a))
101 r = maxloc(a, dim = 1, mask = .true.)
102 if (any(shape(r) /= (/ 4, 5 /))) error stop 21
103 if (any(r /= reshape(data1, (/ 4, 5 /)))) error stop 22
104 r = maxloc(a, dim = 2, mask = .true.)
105 if (any(shape(r) /= (/ 3, 5 /))) error stop 23
106 if (any(r /= reshape(data2, (/ 3, 5 /)))) error stop 24
107 r = maxloc(a, dim = 3, mask = .true.)
108 if (any(shape(r) /= (/ 3, 4 /))) error stop 25
109 if (any(r /= reshape(data3, (/ 3, 4 /)))) error stop 26
110 end subroutine
111 subroutine check_int_const_shape_rank_3_false_mask()
112 integer :: a(3,4,5)
113 integer, allocatable :: r(:,:)
114 a = reshape(data60, shape(a))
115 r = maxloc(a, dim = 1, mask = .false.)
116 if (any(shape(r) /= (/ 4, 5 /))) error stop 31
117 if (any(r /= 0)) error stop 32
118 r = maxloc(a, dim = 2, mask = .false.)
119 if (any(shape(r) /= (/ 3, 5 /))) error stop 33
120 if (any(r /= 0)) error stop 34
121 r = maxloc(a, dim = 3, mask = .false.)
122 if (any(shape(r) /= (/ 3, 4 /))) error stop 35
123 if (any(r /= 0)) error stop 36
124 end subroutine
125 subroutine call_maxloc_int(r, a, d, m)
126 integer :: a(:,:,:)
127 integer :: d
128 logical, optional :: m(:,:,:)
129 integer, allocatable :: r(:,:)
130 r = maxloc(a, dim = d, mask = m)
131 end subroutine
132 subroutine check_int_const_shape_rank_3_optional_mask_present()
133 integer :: a(3,4,5)
134 logical :: m(3,4,5)
135 integer, allocatable :: r(:,:)
136 a = reshape(data60, shape(a))
137 m = reshape(mask60, shape(m))
138 call call_maxloc_int(r, a, 1, m)
139 if (any(shape(r) /= (/ 4, 5 /))) error stop 41
140 if (any(r /= reshape(data1m, (/ 4, 5 /)))) error stop 42
141 call call_maxloc_int(r, a, 2, m)
142 if (any(shape(r) /= (/ 3, 5 /))) error stop 43
143 if (any(r /= reshape(data2m, (/ 3, 5 /)))) error stop 44
144 call call_maxloc_int(r, a, 3, m)
145 if (any(shape(r) /= (/ 3, 4 /))) error stop 45
146 if (any(r /= reshape(data3m, (/ 3, 4 /)))) error stop 46
147 end subroutine
148 subroutine check_int_const_shape_rank_3_optional_mask_absent()
149 integer :: a(3,4,5)
150 integer, allocatable :: r(:,:)
151 a = reshape(data60, shape(a))
152 call call_maxloc_int(r, a, 1)
153 if (any(shape(r) /= (/ 4, 5 /))) error stop 51
154 if (any(r /= reshape(data1, (/ 4, 5 /)))) error stop 52
155 call call_maxloc_int(r, a, 2)
156 if (any(shape(r) /= (/ 3, 5 /))) error stop 53
157 if (any(r /= reshape(data2, (/ 3, 5 /)))) error stop 54
158 call call_maxloc_int(r, a, 3)
159 if (any(shape(r) /= (/ 3, 4 /))) error stop 55
160 if (any(r /= reshape(data3, (/ 3, 4 /)))) error stop 56
161 end subroutine
162 subroutine check_int_const_shape_empty_4()
163 integer :: a(9,3,0,7)
164 logical :: m(9,3,0,7)
165 integer, allocatable :: r(:,:,:)
166 a = reshape((/ integer:: /), shape(a))
167 m = reshape((/ logical:: /), shape(m))
168 r = maxloc(a, dim = 1, mask = m)
169 if (any(shape(r) /= (/ 3, 0, 7 /))) error stop 61
170 r = maxloc(a, dim = 2, mask = m)
171 if (any(shape(r) /= (/ 9, 0, 7 /))) error stop 62
172 r = maxloc(a, dim = 3, mask = m)
173 if (any(shape(r) /= (/ 9, 3, 7 /))) error stop 63
174 if (any(r /= 0)) error stop 64
175 r = maxloc(a, dim = 4, mask = m)
176 if (any(shape(r) /= (/ 9, 3, 0 /))) error stop 65
177 end subroutine
178 subroutine check_int_alloc_rank_3()
179 integer, allocatable :: a(:,:,:)
180 logical, allocatable :: m(:,:,:)
181 integer, allocatable :: r(:,:)
182 allocate(a(3,4,5), m(3,4,5))
183 a(:,:,:) = reshape(data60, shape(a))
184 m(:,:,:) = reshape(mask60, shape(m))
185 r = maxloc(a, dim = 1, mask = m)
186 if (any(shape(r) /= (/ 4, 5 /))) error stop 71
187 if (any(r /= reshape(data1m, (/ 4, 5 /)))) error stop 72
188 r = maxloc(a, dim = 2, mask = m)
189 if (any(shape(r) /= (/ 3, 5 /))) error stop 73
190 if (any(r /= reshape(data2m, (/ 3, 5 /)))) error stop 74
191 r = maxloc(a, dim = 3, mask = m)
192 if (any(shape(r) /= (/ 3, 4 /))) error stop 75
193 if (any(r /= reshape(data3m, (/ 3, 4 /)))) error stop 76
194 end subroutine
195 subroutine check_int_alloc_rank_3_true_mask()
196 integer, allocatable :: a(:,:,:)
197 integer, allocatable :: r(:,:)
198 allocate(a(3,4,5))
199 a(:,:,:) = reshape(data60, shape(a))
200 r = maxloc(a, dim = 1, mask = .true.)
201 if (any(shape(r) /= (/ 4, 5 /))) error stop 81
202 if (any(r /= reshape(data1, (/ 4, 5 /)))) error stop 82
203 r = maxloc(a, dim = 2, mask = .true.)
204 if (any(shape(r) /= (/ 3, 5 /))) error stop 83
205 if (any(r /= reshape(data2, (/ 3, 5 /)))) error stop 84
206 r = maxloc(a, dim = 3, mask = .true.)
207 if (any(shape(r) /= (/ 3, 4 /))) error stop 85
208 if (any(r /= reshape(data3, (/ 3, 4 /)))) error stop 86
209 end subroutine
210 subroutine check_int_alloc_rank_3_false_mask()
211 integer, allocatable :: a(:,:,:)
212 integer, allocatable :: r(:,:)
213 allocate(a(3,4,5))
214 a(:,:,:) = reshape(data60, shape(a))
215 r = maxloc(a, dim = 1, mask = .false.)
216 if (any(shape(r) /= (/ 4, 5 /))) error stop 91
217 if (any(r /= 0)) error stop 92
218 r = maxloc(a, dim = 2, mask = .false.)
219 if (any(shape(r) /= (/ 3, 5 /))) error stop 93
220 if (any(r /= 0)) error stop 94
221 r = maxloc(a, dim = 3, mask = .false.)
222 if (any(shape(r) /= (/ 3, 4 /))) error stop 95
223 if (any(r /= 0)) error stop 96
224 end subroutine
225 subroutine check_int_alloc_empty_4()
226 integer, allocatable :: a(:,:,:,:)
227 logical, allocatable :: m(:,:,:,:)
228 integer, allocatable :: r(:,:,:)
229 allocate(a(9,3,0,7), m(9,3,0,7))
230 a(:,:,:,:) = reshape((/ integer:: /), shape(a))
231 m(:,:,:,:) = reshape((/ logical:: /), shape(m))
232 r = maxloc(a, dim = 1, mask = m)
233 if (any(shape(r) /= (/ 3, 0, 7 /))) error stop 101
234 r = maxloc(a, dim = 2, mask = m)
235 if (any(shape(r) /= (/ 9, 0, 7 /))) error stop 102
236 r = maxloc(a, dim = 3, mask = m)
237 if (any(shape(r) /= (/ 9, 3, 7 /))) error stop 103
238 if (any(r /= 0)) error stop 104
239 r = maxloc(a, dim = 4, mask = m)
240 if (any(shape(r) /= (/ 9, 3, 0 /))) error stop 105
241 end subroutine
242 subroutine check_real_const_shape_rank_3()
243 real :: a(3,4,5)
244 logical :: m(3,4,5)
245 integer, allocatable :: r(:,:)
246 a = reshape((/ real:: data60 /), shape(a))
247 m = reshape(mask60, shape(m))
248 r = maxloc(a, dim = 1, mask = m)
249 if (any(shape(r) /= (/ 4, 5 /))) error stop 111
250 if (any(r /= reshape(data1m, (/ 4, 5 /)))) error stop 112
251 r = maxloc(a, dim = 2, mask = m)
252 if (any(shape(r) /= (/ 3, 5 /))) error stop 113
253 if (any(r /= reshape(data2m, (/ 3, 5 /)))) error stop 114
254 r = maxloc(a, dim = 3, mask = m)
255 if (any(shape(r) /= (/ 3, 4 /))) error stop 115
256 if (any(r /= reshape(data3m, (/ 3, 4 /)))) error stop 116
257 end subroutine
258 subroutine check_real_const_shape_rank_3_true_mask()
259 real :: a(3,4,5)
260 integer, allocatable :: r(:,:)
261 a = reshape((/ real:: data60 /), shape(a))
262 r = maxloc(a, dim = 1, mask = .true.)
263 if (any(shape(r) /= (/ 4, 5 /))) error stop 121
264 if (any(r /= reshape(data1, (/ 4, 5 /)))) error stop 122
265 r = maxloc(a, dim = 2, mask = .true.)
266 if (any(shape(r) /= (/ 3, 5 /))) error stop 123
267 if (any(r /= reshape(data2, (/ 3, 5 /)))) error stop 124
268 r = maxloc(a, dim = 3, mask = .true.)
269 if (any(shape(r) /= (/ 3, 4 /))) error stop 125
270 if (any(r /= reshape(data3, (/ 3, 4 /)))) error stop 126
271 end subroutine
272 subroutine check_real_const_shape_rank_3_false_mask()
273 real :: a(3,4,5)
274 integer, allocatable :: r(:,:)
275 a = reshape((/ real:: data60 /), shape(a))
276 r = maxloc(a, dim = 1, mask = .false.)
277 if (any(shape(r) /= (/ 4, 5 /))) error stop 131
278 if (any(r /= 0)) error stop 132
279 r = maxloc(a, dim = 2, mask = .false.)
280 if (any(shape(r) /= (/ 3, 5 /))) error stop 133
281 if (any(r /= 0)) error stop 134
282 r = maxloc(a, dim = 3, mask = .false.)
283 if (any(shape(r) /= (/ 3, 4 /))) error stop 135
284 if (any(r /= 0)) error stop 136
285 end subroutine
286 subroutine call_maxloc_real(r, a, d, m)
287 real :: a(:,:,:)
288 integer :: d
289 logical, optional :: m(:,:,:)
290 integer, allocatable :: r(:,:)
291 r = maxloc(a, dim = d, mask = m)
292 end subroutine
293 subroutine check_real_const_shape_rank_3_optional_mask_present()
294 real :: a(3,4,5)
295 logical :: m(3,4,5)
296 integer, allocatable :: r(:,:)
297 a = reshape((/ real:: data60 /), shape(a))
298 m = reshape(mask60, shape(m))
299 call call_maxloc_real(r, a, 1, m)
300 if (any(shape(r) /= (/ 4, 5 /))) error stop 141
301 if (any(r /= reshape(data1m, (/ 4, 5 /)))) error stop 142
302 call call_maxloc_real(r, a, 2, m)
303 if (any(shape(r) /= (/ 3, 5 /))) error stop 143
304 if (any(r /= reshape(data2m, (/ 3, 5 /)))) error stop 144
305 call call_maxloc_real(r, a, 3, m)
306 if (any(shape(r) /= (/ 3, 4 /))) error stop 145
307 if (any(r /= reshape(data3m, (/ 3, 4 /)))) error stop 146
308 end subroutine
309 subroutine check_real_const_shape_rank_3_optional_mask_absent()
310 real :: a(3,4,5)
311 integer, allocatable :: r(:,:)
312 a = reshape((/ real:: data60 /), shape(a))
313 call call_maxloc_real(r, a, 1)
314 if (any(shape(r) /= (/ 4, 5 /))) error stop 151
315 if (any(r /= reshape(data1, (/ 4, 5 /)))) error stop 152
316 call call_maxloc_real(r, a, 2)
317 if (any(shape(r) /= (/ 3, 5 /))) error stop 153
318 if (any(r /= reshape(data2, (/ 3, 5 /)))) error stop 154
319 call call_maxloc_real(r, a, 3)
320 if (any(shape(r) /= (/ 3, 4 /))) error stop 155
321 if (any(r /= reshape(data3, (/ 3, 4 /)))) error stop 156
322 end subroutine
323 subroutine check_real_const_shape_empty_4()
324 real :: a(9,3,0,7)
325 logical :: m(9,3,0,7)
326 integer, allocatable :: r(:,:,:)
327 a = reshape((/ real:: /), shape(a))
328 m = reshape((/ logical:: /), shape(m))
329 r = maxloc(a, dim = 1, mask = m)
330 if (any(shape(r) /= (/ 3, 0, 7 /))) error stop 161
331 r = maxloc(a, dim = 2, mask = m)
332 if (any(shape(r) /= (/ 9, 0, 7 /))) error stop 162
333 r = maxloc(a, dim = 3, mask = m)
334 if (any(shape(r) /= (/ 9, 3, 7 /))) error stop 163
335 if (any(r /= 0)) error stop 164
336 r = maxloc(a, dim = 4, mask = m)
337 if (any(shape(r) /= (/ 9, 3, 0 /))) error stop 165
338 end subroutine
339 subroutine check_real_alloc_rank_3()
340 real, allocatable :: a(:,:,:)
341 logical, allocatable :: m(:,:,:)
342 integer, allocatable :: r(:,:)
343 allocate(a(3,4,5), m(3,4,5))
344 a(:,:,:) = reshape((/ real:: data60 /), shape(a))
345 m(:,:,:) = reshape(mask60, shape(m))
346 r = maxloc(a, dim = 1, mask = m)
347 if (any(shape(r) /= (/ 4, 5 /))) error stop 171
348 if (any(r /= reshape(data1m, (/ 4, 5 /)))) error stop 172
349 r = maxloc(a, dim = 2, mask = m)
350 if (any(shape(r) /= (/ 3, 5 /))) error stop 173
351 if (any(r /= reshape(data2m, (/ 3, 5 /)))) error stop 174
352 r = maxloc(a, dim = 3, mask = m)
353 if (any(shape(r) /= (/ 3, 4 /))) error stop 175
354 if (any(r /= reshape(data3m, (/ 3, 4 /)))) error stop 176
355 end subroutine
356 subroutine check_real_alloc_rank_3_true_mask()
357 real, allocatable :: a(:,:,:)
358 integer, allocatable :: r(:,:)
359 allocate(a(3,4,5))
360 a(:,:,:) = reshape((/ real:: data60 /), shape(a))
361 r = maxloc(a, dim = 1, mask = .true.)
362 if (any(shape(r) /= (/ 4, 5 /))) error stop 181
363 if (any(r /= reshape(data1, (/ 4, 5 /)))) error stop 182
364 r = maxloc(a, dim = 2, mask = .true.)
365 if (any(shape(r) /= (/ 3, 5 /))) error stop 183
366 if (any(r /= reshape(data2, (/ 3, 5 /)))) error stop 184
367 r = maxloc(a, dim = 3, mask = .true.)
368 if (any(shape(r) /= (/ 3, 4 /))) error stop 185
369 if (any(r /= reshape(data3, (/ 3, 4 /)))) error stop 186
370 end subroutine
371 subroutine check_real_alloc_rank_3_false_mask()
372 real, allocatable :: a(:,:,:)
373 integer, allocatable :: r(:,:)
374 allocate(a(3,4,5))
375 a(:,:,:) = reshape((/ real:: data60 /), shape(a))
376 r = maxloc(a, dim = 1, mask = .false.)
377 if (any(shape(r) /= (/ 4, 5 /))) error stop 191
378 if (any(r /= 0)) error stop 192
379 r = maxloc(a, dim = 2, mask = .false.)
380 if (any(shape(r) /= (/ 3, 5 /))) error stop 193
381 if (any(r /= 0)) error stop 194
382 r = maxloc(a, dim = 3, mask = .false.)
383 if (any(shape(r) /= (/ 3, 4 /))) error stop 195
384 if (any(r /= 0)) error stop 196
385 end subroutine
386 subroutine check_real_alloc_empty_4()
387 real, allocatable :: a(:,:,:,:)
388 logical, allocatable :: m(:,:,:,:)
389 integer, allocatable :: r(:,:,:)
390 allocate(a(9,3,0,7), m(9,3,0,7))
391 a(:,:,:,:) = reshape((/ real:: /), shape(a))
392 m(:,:,:,:) = reshape((/ logical :: /), shape(m))
393 r = maxloc(a, dim = 1, mask = m)
394 if (any(shape(r) /= (/ 3, 0, 7 /))) error stop 201
395 r = maxloc(a, dim = 2, mask = m)
396 if (any(shape(r) /= (/ 9, 0, 7 /))) error stop 202
397 r = maxloc(a, dim = 3, mask = m)
398 if (any(shape(r) /= (/ 9, 3, 7 /))) error stop 203
399 if (any(r /= 0)) error stop 204
400 r = maxloc(a, dim = 4, mask = m)
401 if (any(shape(r) /= (/ 9, 3, 0 /))) error stop 205
402 end subroutine
403 subroutine check_lower_bounds()
404 real, allocatable :: a(:,:,:)
405 logical, allocatable :: m(:,:,:)
406 integer, allocatable :: r(:,:)
407 allocate(a(3:5,-1:2,5), m(3:5,-1:2,5))
408 a(:,:,:) = reshape((/ real:: data60 /), shape(a))
409 m = reshape(mask60, shape(m))
410 r = maxloc(a, dim = 1, mask = m)
411 if (any(shape(r) /= (/ 4, 5 /))) error stop 211
412 if (any(lbound(r) /= 1)) error stop 212
413 if (any(ubound(r) /= (/ 4, 5 /))) error stop 213
414 r = maxloc(a, dim = 2, mask = m)
415 if (any(shape(r) /= (/ 3, 5 /))) error stop 214
416 if (any(lbound(r) /= 1)) error stop 215
417 if (any(ubound(r) /= (/ 3, 5 /))) error stop 216
418 r = maxloc(a, dim = 3, mask = m)
419 if (any(shape(r) /= (/ 3, 4 /))) error stop 217
420 if (any(lbound(r) /= 1)) error stop 218
421 if (any(ubound(r) /= (/ 3, 4 /))) error stop 219
422 end subroutine
423 elemental subroutine set(o, i)
424 real, intent(out) :: o
425 integer, intent(in) :: i
426 o = i
427 end subroutine
428 subroutine check_dependencies()
429 real, allocatable :: a(:,:,:)
430 logical, allocatable :: m(:,:,:)
431 allocate(a(3,4,5),m(3,4,5))
432 m(:,:,:) = reshape(mask60, shape(m))
433 a(:,:,:) = reshape(data60, shape(a))
434 a(1,:,:) = maxloc(a, dim = 1, mask = m)
435 if (any(a(1,:,:) /= reshape(data1m, (/ 4, 5 /)))) error stop 231
436 a(:,:,:) = reshape(data60, shape(a))
437 a(:,2,:) = maxloc(a, dim = 2, mask = m)
438 if (any(a(:,2,:) /= reshape(data2m, (/ 3, 5 /)))) error stop 232
439 a(:,:,:) = reshape(data60, shape(a))
440 a(:,:,5) = maxloc(a, dim = 3, mask = m)
441 if (any(a(:,:,5) /= reshape(data3m, (/ 3, 4 /)))) error stop 233
442 a(:,:,:) = reshape(data60, shape(a))
443 call set(a(1,:,:), maxloc(a, dim = 1, mask = m))
444 if (any(a(1,:,:) /= reshape(data1m, (/ 4, 5 /)))) error stop 234
445 a(:,:,:) = reshape(data60, shape(a))
446 call set(a(:,2,:), maxloc(a, dim = 2, mask = m))
447 if (any(a(:,2,:) /= reshape(data2m, (/ 3, 5 /)))) error stop 235
448 a(:,:,:) = reshape(data60, shape(a))
449 call set(a(:,:,5), maxloc(a, dim = 3, mask = m))
450 if (any(a(:,:,5) /= reshape(data3m, (/ 3, 4 /)))) error stop 236
451 end subroutine
452 end program p