4 ! The library used to not allocate memory for the result of transformational
5 ! functions reducing an array along one dimension, if the result of the
6 ! function was an empty array. This caused the result to be seen as
7 ! an unallocated array.
14 call check_minloc_char
15 call check_maxloc_char4
16 call check_minval_char
17 call check_maxval_char4
21 subroutine check_iparity
23 logical :: m1(9,3,0,7)
26 integer, allocatable
:: r(:,:,:)
27 a
= reshape((/ integer:: /), shape(a
))
28 m1
= reshape((/ logical:: /), shape(m1
))
32 if (.not
. allocated(r
)) stop 11
35 r
= iparity(a
, dim
=i
, mask
=m1
)
36 if (.not
. allocated(r
)) stop 12
39 r
= iparity(a
, dim
=i
, mask
=m4
)
40 if (.not
. allocated(r
)) stop 13
45 logical :: m1(9,3,0,7)
48 integer, allocatable
:: r(:,:,:)
49 a
= reshape((/ integer:: /), shape(a
))
50 m1
= reshape((/ logical:: /), shape(m1
))
54 if (.not
. allocated(r
)) stop 21
57 r
= sum(a
, dim
=i
, mask
=m1
)
58 if (.not
. allocated(r
)) stop 22
61 r
= sum(a
, dim
=i
, mask
=m4
)
62 if (.not
. allocated(r
)) stop 23
65 subroutine check_minloc_int
67 logical :: m1(9,3,0,7)
70 integer, allocatable
:: r(:,:,:)
71 a
= reshape((/ integer:: /), shape(a
))
72 m1
= reshape((/ logical:: /), shape(m1
))
76 if (.not
. allocated(r
)) stop 31
79 r
= minloc(a
, dim
=i
, mask
=m1
)
80 if (.not
. allocated(r
)) stop 32
83 r
= minloc(a
, dim
=i
, mask
=m4
)
84 if (.not
. allocated(r
)) stop 33
87 subroutine check_minloc_char
88 character :: a(9,3,0,7)
89 logical :: m1(9,3,0,7)
92 integer, allocatable
:: r(:,:,:)
93 a
= reshape((/ character:: /), shape(a
))
94 m1
= reshape((/ logical:: /), shape(m1
))
98 if (.not
. allocated(r
)) stop 41
101 r
= minloc(a
, dim
=i
, mask
=m1
)
102 if (.not
. allocated(r
)) stop 42
105 r
= minloc(a
, dim
=i
, mask
=m4
)
106 if (.not
. allocated(r
)) stop 43
109 subroutine check_maxloc_char4
110 character(kind
=4) :: a(9,3,0,7)
111 logical :: m1(9,3,0,7)
112 logical(kind
=4) :: m4
114 integer, allocatable
:: r(:,:,:)
115 a
= reshape((/ character(kind
=4):: /), shape(a
))
116 m1
= reshape((/ logical:: /), shape(m1
))
120 if (.not
. allocated(r
)) stop 51
123 r
= maxloc(a
, dim
=i
, mask
=m1
)
124 if (.not
. allocated(r
)) stop 52
127 r
= maxloc(a
, dim
=i
, mask
=m4
)
128 if (.not
. allocated(r
)) stop 53
131 subroutine check_minval_char
132 character :: a(9,3,0,7)
133 logical :: m1(9,3,0,7)
134 logical(kind
=4) :: m4
136 character, allocatable
:: r(:,:,:)
137 a
= reshape((/ character:: /), shape(a
))
138 m1
= reshape((/ logical:: /), shape(m1
))
142 if (.not
. allocated(r
)) stop 61
145 r
= minval(a
, dim
=i
, mask
=m1
)
146 if (.not
. allocated(r
)) stop 62
149 r
= minval(a
, dim
=i
, mask
=m4
)
150 if (.not
. allocated(r
)) stop 63
153 subroutine check_maxval_char4
154 character(kind
=4) :: a(9,3,0,7)
155 logical :: m1(9,3,0,7)
156 logical(kind
=4) :: m4
158 character(kind
=4), allocatable
:: r(:,:,:)
159 a
= reshape((/ character(kind
=4):: /), shape(a
))
160 m1
= reshape((/ logical:: /), shape(m1
))
164 if (.not
. allocated(r
)) stop 71
167 r
= maxval(a
, dim
=i
, mask
=m1
)
168 if (.not
. allocated(r
)) stop 72
171 r
= maxval(a
, dim
=i
, mask
=m4
)
172 if (.not
. allocated(r
)) stop 73
176 logical :: a(9,3,0,7)
178 logical, allocatable
:: r(:,:,:)
179 a
= reshape((/ logical:: /), shape(a
))
182 if (.not
. allocated(r
)) stop 81
185 subroutine check_count4
186 logical(kind
=4) :: a(9,3,0,7)
188 integer, allocatable
:: r(:,:,:)
189 a
= reshape((/ logical(kind
=4):: /), shape(a
))
192 if (.not
. allocated(r
)) stop 91