Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gfortran.dg/minmaxloc_12.f90 @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 ! { dg-do run } | |
2 ! Test compile-time simplification of minloc and maxloc with BACK argument | |
3 program main | |
4 integer, parameter :: i1(*) = [ 1,2,3,1,2,3]; | |
5 integer, parameter :: d1 = minloc(i1,dim=1,back=.true.) | |
6 integer, parameter :: d2 = minloc(i1,dim=1,back=.false.) | |
7 integer, parameter :: d3 = maxloc(i1,dim=1,back=.true.) | |
8 integer, parameter :: d4 = maxloc(i1,dim=1,back=.false.) | |
9 integer, parameter :: i2(4,4) = reshape([1,2,1,2,2,3,3,2,3,4,4,3,4,5,5,4], & | |
10 [4,4]); | |
11 integer, parameter :: d5(2) = minloc(i2,back=.true.) | |
12 integer, parameter :: d6(2) = maxloc(i2,back=.true.) | |
13 integer, parameter :: d7(4) = minloc(i2,dim=1,back=.true.) | |
14 integer, parameter :: d25(4) = minloc(i2,dim=2,mask=i2<2,back=.true.) | |
15 integer, parameter :: d26(4) = maxloc(i2,dim=1,mask=i2<3,back=.true.) | |
16 | |
17 integer, parameter :: i3(4,4) = transpose(i2) | |
18 integer, parameter :: d8(4) = minloc(i3,dim=2,back=.true.) | |
19 integer, parameter :: i4(4,4) = reshape([1,2,1,2,2,1,2,1,1,2,1,2,2,1,2,1],& | |
20 ([4,4])) | |
21 integer, parameter :: d9(4) = minloc(i4,dim=1,mask=i4>1,back=.true.) | |
22 | |
23 integer, parameter :: d10(4) = maxloc(i4,dim=1,mask=i4>1,back=.true.) | |
24 character(len=2), parameter :: c0(9) = ["aa", "bb", "aa", & | |
25 "cc", "bb", "cc", "aa", "bb", "aa"] | |
26 character(len=2), parameter :: c1 (3,3) = reshape(c0, [3,3]); | |
27 integer, parameter :: d11(2) = minloc(c1,back=.true.) | |
28 integer, parameter :: d12(2) = maxloc(c1,back=.true.) | |
29 integer, parameter :: d13(2) = minloc(c1,mask=c1>"aa",back=.true.) | |
30 integer, parameter :: d14(2) = maxloc(c1,mask=c1<"cc",back=.true.) | |
31 integer, parameter :: d15(3) = minloc(c1,dim=1,back=.true.) | |
32 integer, parameter :: d16(3) = maxloc(c1,dim=1,back=.true.) | |
33 integer, parameter :: d17(3) = minloc(c1,dim=2,back=.true.) | |
34 integer, parameter :: d18(3) = maxloc(c1,dim=2,back=.true.) | |
35 integer, parameter :: d19 = minloc(c0,dim=1,back=.true.) | |
36 integer, parameter :: d20 = maxloc(c0,dim=1,back=.true.) | |
37 integer, parameter :: d21 = minloc(c0,dim=1,mask=c0>"aa",back=.true.) | |
38 integer, parameter :: d22 = maxloc(c0,dim=1,mask=c0<"cc",back=.true.) | |
39 integer, parameter :: d23(3) = minloc(c1,dim=2,mask=c1>"aa",back=.true.) | |
40 integer, parameter :: d24(3) = maxloc(c1,dim=2,mask=c1<"cc",back=.true.) | |
41 | |
42 if (d1 /= 4) STOP 2078 | |
43 if (d2 /= 1) STOP 2079 | |
44 if (d3 /= 6) STOP 2080 | |
45 if (d4 /= 3) STOP 2081 | |
46 if (any (d5 /= [3,1])) STOP 2082 | |
47 if (any (d6 /= [3,4])) STOP 2083 | |
48 if (any (d7 /= [3,4,4,4])) STOP 2084 | |
49 if (any (d8 /= d7)) STOP 2085 | |
50 if (any (d9 /= [4,3,4,3])) STOP 2086 | |
51 if (any (d10 /= d9)) STOP 2087 | |
52 if (any(d11 /= [3,3])) STOP 2088 | |
53 if (any(d12 /= [3,2])) STOP 2089 | |
54 if (any(d13 /= [2,3])) STOP 2090 | |
55 if (any(d14 /= [2,3])) STOP 2091 | |
56 if (any(d15 /= [3,2,3])) STOP 2092 | |
57 if (any(d16 /= [2,3,2])) STOP 2093 | |
58 if (any(d17 /= [3,3,3])) STOP 2094 | |
59 if (any(d18 /= [2,3,2])) STOP 2095 | |
60 if (d19 /= 9) STOP 2096 | |
61 if (d20 /= 6) STOP 2097 | |
62 if (d21 /= 8 .or. d22 /= 8) STOP 2098 | |
63 if (any(d23 /= [2,3,2])) STOP 2099 | |
64 if (any(d24 /= 3)) STOP 2100 | |
65 if (any(d25 /= [1,0,1,0])) STOP 2101 | |
66 if (any(d26 /= [4,4,0,0])) STOP 2102 | |
67 end program main |