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
)) STOP 1
33 if (any(res1
/= res2
)) STOP 2
36 res1
= minloc(c
,mask
=amask
)
37 res2
= minloc(a
,mask
=amask
)
39 if (any(res1
/= res2
)) STOP 3
42 res1
= minloc(c
,mask
=amask
)
43 if (any(res1
/= 0)) STOP 4
46 res1
= minloc(c
,mask
=amask
)
47 if (any(res1
/= [2,3])) STOP 5
49 res1
= minloc(c
,mask
=.false
.)
50 if (any(res1
/= 0)) STOP 6
53 res1
= minloc(c
,mask
=.true
.)
54 if (any(res1
/= res2
)) STOP 7
58 if (any(q1
/= q2
)) STOP 8
62 if (any(q1
/= q2
)) STOP 9
64 q1
= minloc(c
, dim
=1, mask
=amask
)
65 q2
= minloc(a
, dim
=1, mask
=amask
)
66 if (any(q1
/= q2
)) STOP 10
68 q1
= minloc(c
, dim
=2, mask
=amask
)
69 q2
= minloc(a
, dim
=2, mask
=amask
)
70 if (any(q1
/= q2
)) STOP 11
74 q1
= minloc(c
, dim
=1, mask
=amask
)
75 q2
= minloc(a
, dim
=1, mask
=amask
)
76 if (any(q1
/= q2
)) STOP 12
78 q1
= minloc(c
, dim
=2, mask
=amask
)
79 q2
= minloc(a
, dim
=2, mask
=amask
)
80 if (any(q1
/= q2
)) STOP 13
82 e
= reshape(c
, shape(e
))
83 f
= reshape(a
, shape(f
))
84 if (minloc(e
,dim
=1) /= minloc(f
,dim
=1)) STOP 14
87 if (minloc(e
,dim
=1,mask
=cmask
) /= 0) STOP 15
90 if ( minloc(e
, dim
=1, mask
=cmask
) /= minloc (f
, dim
=1, mask
=cmask
)) STOP 16