Skip to content
This repository was archived by the owner on Mar 1, 2024. It is now read-only.

Commit f416d26

Browse files
authored
bugfix: fixed bugs suspected by cppcheck: shift signed 32-bit value by 31 bits and uninitialized variable. (mpx#76)
[dtoa.c:2453] -> [dtoa.c:2454]: (warning) Shifting signed 32-bit value by 31 bits is undefined behaviour. See condition at line 2453. [dtoa.c:2846]: (error) Uninitialized variable: bb [dtoa.c:2847]: (error) Uninitialized variable: bd [dtoa.c:2848]: (error) Uninitialized variable: bs [dtoa.c:2850]: (error) Uninitialized variable: delta
1 parent 8dadbca commit f416d26

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

dtoa.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2451,10 +2451,10 @@ bigcomp
24512451
if ((j = ((word0(rv) & Exp_mask) >> Exp_shift) - bc->scale) <= 0) {
24522452
i = 1 - j;
24532453
if (i <= 31) {
2454-
if (word1(rv) & (0x1 << i))
2454+
if (word1(rv) & (0x1U << i))
24552455
goto odd;
24562456
}
2457-
else if (word0(rv) & (0x1 << (i-32)))
2457+
else if (word0(rv) & (0x1U << (i-32)))
24582458
goto odd;
24592459
}
24602460
else if (word1(rv) & 1) {
@@ -2488,7 +2488,11 @@ fpconv_strtod
24882488
U aadj2, adj, rv, rv0;
24892489
ULong y, z;
24902490
BCinfo bc;
2491-
Bigint *bb, *bb1, *bd, *bd0, *bs, *delta;
2491+
Bigint *bb1, *bd0;
2492+
Bigint *bb = NULL;
2493+
Bigint *bd = NULL;
2494+
Bigint *bs = NULL;
2495+
Bigint *delta = NULL;
24922496
#ifdef Avoid_Underflow
24932497
ULong Lsb, Lsb1;
24942498
#endif

0 commit comments

Comments
 (0)