2 ! Test minloc for strings for different code paths
6 integer, parameter :: n
=4
7 character(len
=4), dimension(n
,n
) :: c
8 integer, dimension(n
,n
) :: a
9 integer, dimension(2) :: res1
, res2
10 real, dimension(n
,n
) :: r
11 logical, dimension(n
,n
) :: amask
12 logical(kind
=8) :: smask
14 integer, dimension(n
) :: q1
, q2
15 character(len
=4,kind
=4), dimension(n
,n
) :: c4
16 character(len
=4), dimension(n
*n
) :: e
17 integer, dimension(n
*n
) :: f
18 logical, dimension(n
*n
) :: cmask
20 call random_number (r
)
24 write (unit
=c(i
,j
),fmt
='(I4.4)') a(i
,j
)
25 write (unit
=c4(i
,j
),fmt
='(I4.4)') a(i
,j
)
31 if (any(res1
/= res2
)) call abort
33 if (any(res1
/= res2
)) call abort
36 res1
= minloc(c
,mask
=amask
)
37 res2
= minloc(a
,mask
=amask
)
39 if (any(res1
/= res2
)) call abort
42 res1
= minloc(c
,mask
=amask
)
43 if (any(res1
/= 0)) call abort
46 res1
= minloc(c
,mask
=amask
)
47 if (any(res1
/= [2,3])) call abort
49 res1
= minloc(c
,mask
=.false
.)
50 if (any(res1
/= 0)) call abort
53 res1
= minloc(c
,mask
=.true
.)
54 if (any(res1
/= res2
)) call abort
58 if (any(q1
/= q2
)) call abort
62 if (any(q1
/= q2
)) call abort
64 q1
= minloc(c
, dim
=1, mask
=amask
)
65 q2
= minloc(a
, dim
=1, mask
=amask
)
66 if (any(q1
/= q2
)) call abort
68 q1
= minloc(c
, dim
=2, mask
=amask
)
69 q2
= minloc(a
, dim
=2, mask
=amask
)
70 if (any(q1
/= q2
)) call abort
74 q1
= minloc(c
, dim
=1, mask
=amask
)
75 q2
= minloc(a
, dim
=1, mask
=amask
)
76 if (any(q1
/= q2
)) call abort
78 q1
= minloc(c
, dim
=2, mask
=amask
)
79 q2
= minloc(a
, dim
=2, mask
=amask
)
80 if (any(q1
/= q2
)) call abort
82 e
= reshape(c
, shape(e
))
83 f
= reshape(a
, shape(f
))
84 if (minloc(e
,dim
=1) /= minloc(f
,dim
=1)) call abort
87 if (minloc(e
,dim
=1,mask
=cmask
) /= 0) call abort
90 if ( minloc(e
, dim
=1, mask
=cmask
) /= minloc (f
, dim
=1, mask
=cmask
)) call abort