2 ! { dg-options "-fdump-tree-original" }
3 ! Test that minloc and maxloc using KINDs return the right
4 ! kind, by using unformatted I/O for a specific kind.
7 real, dimension(3) :: a
8 integer :: r1
, r2
, r4
, r8
10 character(len
=30) :: l1
, l2
12 ! Check via I/O if the KIND is used correctly
14 write (unit
=l1
,fmt
=*) 2_1
15 write (unit
=l2
,fmt
=*) maxloc(a
,kind
=1)
16 if (l1
/= l2
) call abort
18 write (unit
=l1
,fmt
=*) 2_2
19 write (unit
=l2
,fmt
=*) maxloc(a
,kind
=2)
20 if (l1
/= l2
) call abort
22 write (unit
=l1
,fmt
=*) 2_4
23 write (unit
=l2
,fmt
=*) maxloc(a
,kind
=4)
24 if (l1
/= l2
) call abort
26 write (unit
=l1
,fmt
=*) 2_8
27 write (unit
=l2
,fmt
=*) maxloc(a
,kind
=8)
28 if (l1
/= l2
) call abort
32 write (unit
=l1
,fmt
=*) 2_1
33 write (unit
=l2
,fmt
=*) minloc(a
,kind
=1)
34 if (l1
/= l2
) call abort
36 write (unit
=l1
,fmt
=*) 2_2
37 write (unit
=l2
,fmt
=*) minloc(a
,kind
=2)
38 if (l1
/= l2
) call abort
40 write (unit
=l1
,fmt
=*) 2_4
41 write (unit
=l2
,fmt
=*) minloc(a
,kind
=4)
42 if (l1
/= l2
) call abort
44 write (unit
=l1
,fmt
=*) 2_8
45 write (unit
=l2
,fmt
=*) minloc(a
,kind
=8)
46 if (l1
/= l2
) call abort