Bug Summary

File:src/lib/libm/src/e_hypotf.c
Warning:line 29, column 48
Value stored to 'a' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple amd64-unknown-openbsd7.0 -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name e_hypotf.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 1 -pic-is-pie -mframe-pointer=all -relaxed-aliasing -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-feature +retpoline-indirect-calls -target-feature +retpoline-indirect-branches -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/usr/src/lib/libm/obj -resource-dir /usr/local/lib/clang/13.0.0 -include namespace.h -I /usr/src/lib/libm/arch/amd64 -I /usr/src/lib/libm/src -I /usr/src/lib/libm/src/ld80 -I /usr/src/lib/libm/hidden -internal-isystem /usr/local/lib/clang/13.0.0/include -internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir=/usr/src/lib/libm/obj -ferror-limit 19 -fwrapv -D_RET_PROTECTOR -ret-protector -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free -fno-builtin-strdup -fno-builtin-strndup -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/ben/Projects/vmm/scan-build/2022-01-12-194120-40624-1 -x c /usr/src/lib/libm/src/e_hypotf.c
1/* e_hypotf.c -- float version of e_hypot.c.
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3 */
4
5/*
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8 *
9 * Developed at SunPro, a Sun Microsystems, Inc. business.
10 * Permission to use, copy, modify, and distribute this
11 * software is freely granted, provided that this notice
12 * is preserved.
13 * ====================================================
14 */
15
16#include "math.h"
17#include "math_private.h"
18
19float
20hypotf(float x, float y)
21{
22 float a=x,b=y,t1,t2,yy1,y2,w;
23 int32_t j,k,ha,hb;
24
25 GET_FLOAT_WORD(ha,x)do { ieee_float_shape_type gf_u; gf_u.value = (x); (ha) = gf_u
.word; } while (0)
;
26 ha &= 0x7fffffff;
27 GET_FLOAT_WORD(hb,y)do { ieee_float_shape_type gf_u; gf_u.value = (y); (hb) = gf_u
.word; } while (0)
;
28 hb &= 0x7fffffff;
29 if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;}
Value stored to 'a' is never read
30 SET_FLOAT_WORD(a,ha)do { ieee_float_shape_type sf_u; sf_u.word = (ha); (a) = sf_u
.value; } while (0)
; /* a <- |a| */
31 SET_FLOAT_WORD(b,hb)do { ieee_float_shape_type sf_u; sf_u.word = (hb); (b) = sf_u
.value; } while (0)
; /* b <- |b| */
32 if((ha-hb)>0xf000000) {return a+b;} /* x/y > 2**30 */
33 k=0;
34 if(ha > 0x58800000) { /* a>2**50 */
35 if(ha >= 0x7f800000) { /* Inf or NaN */
36 w = a+b; /* for sNaN */
37 if(ha == 0x7f800000) w = a;
38 if(hb == 0x7f800000) w = b;
39 return w;
40 }
41 /* scale a and b by 2**-68 */
42 ha -= 0x22000000; hb -= 0x22000000; k += 68;
43 SET_FLOAT_WORD(a,ha)do { ieee_float_shape_type sf_u; sf_u.word = (ha); (a) = sf_u
.value; } while (0)
;
44 SET_FLOAT_WORD(b,hb)do { ieee_float_shape_type sf_u; sf_u.word = (hb); (b) = sf_u
.value; } while (0)
;
45 }
46 if(hb < 0x26800000) { /* b < 2**-50 */
47 if(hb <= 0x007fffff) { /* subnormal b or 0 */
48 if(hb==0) return a;
49 SET_FLOAT_WORD(t1,0x7e800000)do { ieee_float_shape_type sf_u; sf_u.word = (0x7e800000); (t1
) = sf_u.value; } while (0)
; /* t1=2^126 */
50 b *= t1;
51 a *= t1;
52 k -= 126;
53 } else { /* scale a and b by 2^68 */
54 ha += 0x22000000; /* a *= 2^68 */
55 hb += 0x22000000; /* b *= 2^68 */
56 k -= 68;
57 SET_FLOAT_WORD(a,ha)do { ieee_float_shape_type sf_u; sf_u.word = (ha); (a) = sf_u
.value; } while (0)
;
58 SET_FLOAT_WORD(b,hb)do { ieee_float_shape_type sf_u; sf_u.word = (hb); (b) = sf_u
.value; } while (0)
;
59 }
60 }
61 /* medium size a and b */
62 w = a-b;
63 if (w>b) {
64 SET_FLOAT_WORD(t1,ha&0xfffff000)do { ieee_float_shape_type sf_u; sf_u.word = (ha&0xfffff000
); (t1) = sf_u.value; } while (0)
;
65 t2 = a-t1;
66 w = sqrtf(t1*t1-(b*(-b)-t2*(a+t1)));
67 } else {
68 a = a+a;
69 SET_FLOAT_WORD(yy1,hb&0xfffff000)do { ieee_float_shape_type sf_u; sf_u.word = (hb&0xfffff000
); (yy1) = sf_u.value; } while (0)
;
70 y2 = b - yy1;
71 SET_FLOAT_WORD(t1,ha+0x00800000)do { ieee_float_shape_type sf_u; sf_u.word = (ha+0x00800000);
(t1) = sf_u.value; } while (0)
;
72 t2 = a - t1;
73 w = sqrtf(t1*yy1-(w*(-w)-(t1*y2+t2*b)));
74 }
75 if(k!=0) {
76 SET_FLOAT_WORD(t1,0x3f800000+(k<<23))do { ieee_float_shape_type sf_u; sf_u.word = (0x3f800000+(k<<
23)); (t1) = sf_u.value; } while (0)
;
77 return t1*w;
78 } else return w;
79}
80DEF_STD(hypotf)__asm__(".global " "hypotf" " ; " "hypotf" " = " "_libm_hypotf"
)
;