Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gfortran.dg / leadz_trailz_1.f90
bloba0cd19792255d21b826952f73d1a936200b6dd35
1 ! { dg-do run }
3 integer(kind=1) :: i1
4 integer(kind=2) :: i2
5 integer(kind=4) :: i4
6 integer(kind=8) :: i8
8 i1 = -1
9 i2 = -1
10 i4 = -1
11 i8 = -1
13 if (leadz(i1) /= 0) call abort
14 if (leadz(i2) /= 0) call abort
15 if (leadz(i4) /= 0) call abort
16 if (leadz(i8) /= 0) call abort
18 if (trailz(i1) /= 0) call abort
19 if (trailz(i2) /= 0) call abort
20 if (trailz(i4) /= 0) call abort
21 if (trailz(i8) /= 0) call abort
23 if (leadz(-1_1) /= 0) call abort
24 if (leadz(-1_2) /= 0) call abort
25 if (leadz(-1_4) /= 0) call abort
26 if (leadz(-1_8) /= 0) call abort
28 if (trailz(-1_1) /= 0) call abort
29 if (trailz(-1_2) /= 0) call abort
30 if (trailz(-1_4) /= 0) call abort
31 if (trailz(-1_8) /= 0) call abort
33 i1 = -64
34 i2 = -64
35 i4 = -64
36 i8 = -64
38 if (leadz(i1) /= 0) call abort
39 if (leadz(i2) /= 0) call abort
40 if (leadz(i4) /= 0) call abort
41 if (leadz(i8) /= 0) call abort
43 if (trailz(i1) /= 6) call abort
44 if (trailz(i2) /= 6) call abort
45 if (trailz(i4) /= 6) call abort
46 if (trailz(i8) /= 6) call abort
48 if (leadz(-64_1) /= 0) call abort
49 if (leadz(-64_2) /= 0) call abort
50 if (leadz(-64_4) /= 0) call abort
51 if (leadz(-64_8) /= 0) call abort
53 if (trailz(-64_1) /= 6) call abort
54 if (trailz(-64_2) /= 6) call abort
55 if (trailz(-64_4) /= 6) call abort
56 if (trailz(-64_8) /= 6) call abort
58 i1 = -108
59 i2 = -108
60 i4 = -108
61 i8 = -108
63 if (leadz(i1) /= 0) call abort
64 if (leadz(i2) /= 0) call abort
65 if (leadz(i4) /= 0) call abort
66 if (leadz(i8) /= 0) call abort
68 if (trailz(i1) /= 2) call abort
69 if (trailz(i2) /= 2) call abort
70 if (trailz(i4) /= 2) call abort
71 if (trailz(i8) /= 2) call abort
73 if (leadz(-108_1) /= 0) call abort
74 if (leadz(-108_2) /= 0) call abort
75 if (leadz(-108_4) /= 0) call abort
76 if (leadz(-108_8) /= 0) call abort
78 if (trailz(-108_1) /= 2) call abort
79 if (trailz(-108_2) /= 2) call abort
80 if (trailz(-108_4) /= 2) call abort
81 if (trailz(-108_8) /= 2) call abort
83 i1 = 1
84 i2 = 1
85 i4 = 1
86 i8 = 1
88 if (leadz(i1) /= bit_size(i1) - 1) call abort
89 if (leadz(i2) /= bit_size(i2) - 1) call abort
90 if (leadz(i4) /= bit_size(i4) - 1) call abort
91 if (leadz(i8) /= bit_size(i8) - 1) call abort
93 if (trailz(i1) /= 0) call abort
94 if (trailz(i2) /= 0) call abort
95 if (trailz(i4) /= 0) call abort
96 if (trailz(i8) /= 0) call abort
98 if (leadz(1_1) /= bit_size(1_1) - 1) call abort
99 if (leadz(1_2) /= bit_size(1_2) - 1) call abort
100 if (leadz(1_4) /= bit_size(1_4) - 1) call abort
101 if (leadz(1_8) /= bit_size(1_8) - 1) call abort
103 if (trailz(1_1) /= 0) call abort
104 if (trailz(1_2) /= 0) call abort
105 if (trailz(1_4) /= 0) call abort
106 if (trailz(1_8) /= 0) call abort
108 i1 = 64
109 i2 = 64
110 i4 = 64
111 i8 = 64
113 if (leadz(i1) /= 1) call abort
114 if (leadz(i2) /= 9) call abort
115 if (leadz(i4) /= 25) call abort
116 if (leadz(i8) /= 57) call abort
118 if (trailz(i1) /= 6) call abort
119 if (trailz(i2) /= 6) call abort
120 if (trailz(i4) /= 6) call abort
121 if (trailz(i8) /= 6) call abort
123 if (leadz(64_1) /= 1) call abort
124 if (leadz(64_2) /= 9) call abort
125 if (leadz(64_4) /= 25) call abort
126 if (leadz(64_8) /= 57) call abort
128 if (trailz(64_1) /= 6) call abort
129 if (trailz(64_2) /= 6) call abort
130 if (trailz(64_4) /= 6) call abort
131 if (trailz(64_8) /= 6) call abort