PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / minmaxloc_8.f90
blobe4097e50d4bd86423194586d12ea3828162ed9a9
1 ! { dg-do run }
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.
5 program main
6 implicit none
7 real, dimension(3) :: a
8 integer :: r1, r2, r4, r8
9 integer :: k
10 character(len=30) :: l1, l2
12 ! Check via I/O if the KIND is used correctly
13 a = [ 1.0, 3.0, 2.0]
14 write (unit=l1,fmt=*) 2_1
15 write (unit=l2,fmt=*) maxloc(a,kind=1)
16 if (l1 /= l2) STOP 1
18 write (unit=l1,fmt=*) 2_2
19 write (unit=l2,fmt=*) maxloc(a,kind=2)
20 if (l1 /= l2) STOP 2
22 write (unit=l1,fmt=*) 2_4
23 write (unit=l2,fmt=*) maxloc(a,kind=4)
24 if (l1 /= l2) STOP 3
26 write (unit=l1,fmt=*) 2_8
27 write (unit=l2,fmt=*) maxloc(a,kind=8)
28 if (l1 /= l2) STOP 4
30 a = [ 3.0, -1.0, 2.0]
32 write (unit=l1,fmt=*) 2_1
33 write (unit=l2,fmt=*) minloc(a,kind=1)
34 if (l1 /= l2) STOP 5
36 write (unit=l1,fmt=*) 2_2
37 write (unit=l2,fmt=*) minloc(a,kind=2)
38 if (l1 /= l2) STOP 6
40 write (unit=l1,fmt=*) 2_4
41 write (unit=l2,fmt=*) minloc(a,kind=4)
42 if (l1 /= l2) STOP 7
44 write (unit=l1,fmt=*) 2_8
45 write (unit=l2,fmt=*) minloc(a,kind=8)
46 if (l1 /= l2) STOP 8
48 end program main