Bug Summary

File:src/lib/libc/gdtoa/strtof.c
Warning:line 79, column 10
The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage

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 strtof.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/libc/obj -resource-dir /usr/local/lib/clang/13.0.0 -include namespace.h -I /usr/src/lib/libc/include -I /usr/src/lib/libc/hidden -D __LIBC__ -D APIWARN -D YP -I /usr/src/lib/libc/yp -I /usr/src/lib/libc -I /usr/src/lib/libc/gdtoa -I /usr/src/lib/libc/arch/amd64/gdtoa -D INFNAN_CHECK -D MULTIPLE_THREADS -D NO_FENV_H -D USE_LOCALE -I /usr/src/lib/libc -I /usr/src/lib/libc/citrus -D RESOLVSORT -D FLOATING_POINT -D PRINTF_WIDE_CHAR -D SCANF_WIDE_CHAR -D FUTEX -internal-isystem /usr/local/lib/clang/13.0.0/include -internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir=/usr/src/lib/libc/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/libc/gdtoa/strtof.c
1/****************************************************************
2
3The author of this software is David M. Gay.
4
5Copyright (C) 1998, 2000 by Lucent Technologies
6All Rights Reserved
7
8Permission to use, copy, modify, and distribute this software and
9its documentation for any purpose and without fee is hereby
10granted, provided that the above copyright notice appear in all
11copies and that both that the copyright notice and this
12permission notice and warranty disclaimer appear in supporting
13documentation, and that the name of Lucent or any of its entities
14not be used in advertising or publicity pertaining to
15distribution of the software without specific, written prior
16permission.
17
18LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
19INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
20IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
21SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
22WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
23IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
24ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
25THIS SOFTWARE.
26
27****************************************************************/
28
29/* Please send bug reports to David M. Gay (dmg at acm dot org,
30 * with " at " changed at "@" and " dot " changed to "."). */
31
32#include "gdtoaimp.h"
33
34 float
35#ifdef KR_headers
36strtof(s, sp) CONSTconst char *s; char **sp;
37#else
38strtof(CONSTconst char *s, char **sp)
39#endif
40{
41 static FPI fpi0 = { 24, 1-127-24+1, 254-127-24+1, 1, SI0 };
42 ULong bits[1];
43 Longint exp;
44 int k;
45 union { ULong L[1]; float f; } u;
46#ifdef Honor_FLT_ROUNDS
47#include "gdtoa_fltrnds.h"
48#else
49#define fpi&fpi0 &fpi0
50#endif
51
52 k = strtodg__strtodg(s, sp, fpi&fpi0, &exp, bits);
53 switch(k & STRTOG_Retmask) {
1
'Default' branch taken. Execution continues on line 78
54 case STRTOG_NoNumber:
55 case STRTOG_Zero:
56 u.L[0] = 0;
57 break;
58
59 case STRTOG_Normal:
60 case STRTOG_NaNbits:
61 u.L[0] = (bits[0] & 0x7fffff) | ((exp + 0x7f + 23) << 23);
62 break;
63
64 case STRTOG_Denormal:
65 u.L[0] = bits[0];
66 break;
67
68 case STRTOG_NoMemory:
69 errno(*__errno()) = ERANGE34;
70 /* FALLTHROUGH */
71 case STRTOG_Infinite:
72 u.L[0] = 0x7f800000;
73 break;
74
75 case STRTOG_NaN:
76 u.L[0] = f_QNAN0x7fc00000;
77 }
78 if (k & STRTOG_Neg)
2
Assuming the condition is true
3
Taking true branch
79 u.L[0] |= 0x80000000L;
4
The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage
80 return u.f;
81 }
82DEF_STRONG(strtof)__asm__(".global " "strtof" " ; " "strtof" " = " "_libc_strtof"
)
;