clang -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name k_rem_pio2.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mthread-model posix -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -fmath-errno -ffp-contract=off -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib/llvm-10/lib/clang/10.0.0 -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/support/modules_include/java.base -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/support/modules_include/java.base/linux -I /home/daniel/Projects/java/jdk/src/java.base/share/native/libjava -I /home/daniel/Projects/java/jdk/src/java.base/unix/native/libjava -I /home/daniel/Projects/java/jdk/src/hotspot/share/include -I /home/daniel/Projects/java/jdk/src/hotspot/os/posix/include -D LIBC=gnu -D _GNU_SOURCE -D _REENTRANT -D _LARGEFILE64_SOURCE -D LINUX -D DEBUG -D _LITTLE_ENDIAN -D ARCH="amd64" -D amd64 -D _LP64=1 -I /home/daniel/Projects/java/jdk/src/java.base/share/native/libfdlibm -D LIBRARY_NAME=fdlibm -D _FORTIFY_SOURCE=2 -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-10/lib/clang/10.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wno-unused -Wno-sign-compare -Wno-misleading-indentation -Wno-array-bounds -std=c99 -fdebug-compilation-dir /home/daniel/Projects/java/jdk/make -ferror-limit 19 -fmessage-length 0 -fvisibility hidden -stack-protector 1 -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -o /home/daniel/Projects/java/scan/2021-12-21-193737-8510-1 -x c /home/daniel/Projects/java/jdk/src/java.base/share/native/libfdlibm/k_rem_pio2.c
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | |
43 | |
44 | |
45 | |
46 | |
47 | |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |
55 | |
56 | |
57 | |
58 | |
59 | |
60 | |
61 | |
62 | |
63 | |
64 | |
65 | |
66 | |
67 | |
68 | |
69 | |
70 | |
71 | |
72 | |
73 | |
74 | |
75 | |
76 | |
77 | |
78 | |
79 | |
80 | |
81 | |
82 | |
83 | |
84 | |
85 | |
86 | |
87 | |
88 | |
89 | |
90 | |
91 | |
92 | |
93 | |
94 | |
95 | |
96 | |
97 | |
98 | |
99 | |
100 | |
101 | |
102 | |
103 | |
104 | |
105 | |
106 | |
107 | |
108 | |
109 | |
110 | |
111 | |
112 | |
113 | |
114 | |
115 | |
116 | |
117 | |
118 | |
119 | |
120 | |
121 | |
122 | |
123 | |
124 | |
125 | |
126 | |
127 | |
128 | |
129 | |
130 | |
131 | |
132 | |
133 | |
134 | |
135 | |
136 | |
137 | |
138 | |
139 | |
140 | |
141 | |
142 | #include "fdlibm.h" |
143 | |
144 | #ifdef __STDC__ |
145 | static const int init_jk[] = {2,3,4,6}; |
146 | #else |
147 | static int init_jk[] = {2,3,4,6}; |
148 | #endif |
149 | |
150 | #ifdef __STDC__ |
151 | static const double PIo2[] = { |
152 | #else |
153 | static double PIo2[] = { |
154 | #endif |
155 | 1.57079625129699707031e+00, |
156 | 7.54978941586159635335e-08, |
157 | 5.39030252995776476554e-15, |
158 | 3.28200341580791294123e-22, |
159 | 1.27065575308067607349e-29, |
160 | 1.22933308981111328932e-36, |
161 | 2.73370053816464559624e-44, |
162 | 2.16741683877804819444e-51, |
163 | }; |
164 | |
165 | #ifdef __STDC__ |
166 | static const double |
167 | #else |
168 | static double |
169 | #endif |
170 | zero = 0.0, |
171 | one = 1.0, |
172 | two24 = 1.67772160000000000000e+07, |
173 | twon24 = 5.96046447753906250000e-08; |
174 | |
175 | #ifdef __STDC__ |
176 | int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int *ipio2) |
177 | #else |
178 | int __kernel_rem_pio2(x,y,e0,nx,prec,ipio2) |
179 | double x[], y[]; int e0,nx,prec; int ipio2[]; |
180 | #endif |
181 | { |
182 | int jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; |
183 | double z,fw,f[20],fq[20],q[20]; |
184 | |
185 | |
186 | jk = init_jk[prec]; |
187 | jp = jk; |
188 | |
189 | |
190 | jx = nx-1; |
191 | jv = (e0-3)/24; if(jv<0) jv=0; |
| |
| |
192 | q0 = e0-24*(jv+1); |
193 | |
194 | |
195 | j = jv-jx; m = jx+jk; |
196 | for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (double) ipio2[j]; |
| |
| 4 | | Loop condition is false. Execution continues on line 199 | |
|
197 | |
198 | |
199 | for (i=0;i<=jk;i++) { |
| |
| 6 | | Loop condition is true. Entering loop body | |
|
| |
| 10 | | Loop condition is false. Execution continues on line 203 | |
|
200 | for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw; |
| |
| 8 | | Loop condition is false. Execution continues on line 200 | |
|
201 | } |
202 | |
203 | jz = jk; |
204 | recompute: |
205 | |
206 | for(i=0,j=jz,z=q[jz];j>0;i++,j--) { |
| 11 | | Loop condition is false. Execution continues on line 213 | |
|
207 | fw = (double)((int)(twon24* z)); |
208 | iq[i] = (int)(z-two24*fw); |
209 | z = q[j-1]+fw; |
210 | } |
211 | |
212 | |
213 | z = scalbn(z,q0); |
214 | z -= 8.0*floor(z*0.125); |
215 | n = (int) z; |
216 | z -= (double)n; |
217 | ih = 0; |
218 | if(q0>0) { |
| |
| |
219 | i = (iq[jz-1]>>(24-q0)); n += i; |
| 14 | | The left operand of '>>' is a garbage value due to array index out of bounds |
|
220 | iq[jz-1] -= i<<(24-q0); |
221 | ih = iq[jz-1]>>(23-q0); |
222 | } |
223 | else if(q0==0) ih = iq[jz-1]>>23; |
224 | else if(z>=0.5) ih=2; |
225 | |
226 | if(ih>0) { |
227 | n += 1; carry = 0; |
228 | for(i=0;i<jz ;i++) { |
229 | j = iq[i]; |
230 | if(carry==0) { |
231 | if(j!=0) { |
232 | carry = 1; iq[i] = 0x1000000- j; |
233 | } |
234 | } else iq[i] = 0xffffff - j; |
235 | } |
236 | if(q0>0) { |
237 | switch(q0) { |
238 | case 1: |
239 | iq[jz-1] &= 0x7fffff; break; |
240 | case 2: |
241 | iq[jz-1] &= 0x3fffff; break; |
242 | } |
243 | } |
244 | if(ih==2) { |
245 | z = one - z; |
246 | if(carry!=0) z -= scalbn(one,q0); |
247 | } |
248 | } |
249 | |
250 | |
251 | if(z==zero) { |
252 | j = 0; |
253 | for (i=jz-1;i>=jk;i--) j |= iq[i]; |
254 | if(j==0) { |
255 | for(k=1;iq[jk-k]==0;k++); |
256 | |
257 | for(i=jz+1;i<=jz+k;i++) { |
258 | f[jx+i] = (double) ipio2[jv+i]; |
259 | for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; |
260 | q[i] = fw; |
261 | } |
262 | jz += k; |
263 | goto recompute; |
264 | } |
265 | } |
266 | |
267 | |
268 | if(z==0.0) { |
269 | jz -= 1; q0 -= 24; |
270 | while(iq[jz]==0) { jz--; q0-=24;} |
271 | } else { |
272 | z = scalbn(z,-q0); |
273 | if(z>=two24) { |
274 | fw = (double)((int)(twon24*z)); |
275 | iq[jz] = (int)(z-two24*fw); |
276 | jz += 1; q0 += 24; |
277 | iq[jz] = (int) fw; |
278 | } else iq[jz] = (int) z ; |
279 | } |
280 | |
281 | |
282 | fw = scalbn(one,q0); |
283 | for(i=jz;i>=0;i--) { |
284 | q[i] = fw*(double)iq[i]; fw*=twon24; |
285 | } |
286 | |
287 | |
288 | for(i=jz;i>=0;i--) { |
289 | for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; |
290 | fq[jz-i] = fw; |
291 | } |
292 | |
293 | |
294 | switch(prec) { |
295 | case 0: |
296 | fw = 0.0; |
297 | for (i=jz;i>=0;i--) fw += fq[i]; |
298 | y[0] = (ih==0)? fw: -fw; |
299 | break; |
300 | case 1: |
301 | case 2: |
302 | fw = 0.0; |
303 | for (i=jz;i>=0;i--) fw += fq[i]; |
304 | y[0] = (ih==0)? fw: -fw; |
305 | fw = fq[0]-fw; |
306 | for (i=1;i<=jz;i++) fw += fq[i]; |
307 | y[1] = (ih==0)? fw: -fw; |
308 | break; |
309 | case 3: |
310 | for (i=jz;i>0;i--) { |
311 | fw = fq[i-1]+fq[i]; |
312 | fq[i] += fq[i-1]-fw; |
313 | fq[i-1] = fw; |
314 | } |
315 | for (i=jz;i>1;i--) { |
316 | fw = fq[i-1]+fq[i]; |
317 | fq[i] += fq[i-1]-fw; |
318 | fq[i-1] = fw; |
319 | } |
320 | for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; |
321 | if(ih==0) { |
322 | y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; |
323 | } else { |
324 | y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw; |
325 | } |
326 | } |
327 | return n&7; |
328 | } |