Update to version 3.1.6

This commit is contained in:
Stefan Eßer 2020-10-01 15:40:24 +00:00
parent 592e97f5f6
commit 9fef4b8de3
6 changed files with 19 additions and 5 deletions

View File

@ -29,7 +29,7 @@
#
.POSIX:
VERSION = 3.1.5
VERSION = 3.1.6
SRC = %%SRC%%
OBJ = %%OBJ%%

View File

@ -1,5 +1,13 @@
# News
## 3.1.6
This is a production release that fixes a new warning from Clang 12 for FreeBSD
and also removes some possible undefined behavior found by UBSan that compilers
did not seem to take advantage of.
Users do ***NOT*** need to upgrade, if they do not want to.
## 3.1.5
This is a production release that fixes the Chinese locales (which caused `bc`

View File

@ -173,6 +173,10 @@ extern const BcParseNext bc_parse_next_elem;
extern const BcParseNext bc_parse_next_for;
extern const BcParseNext bc_parse_next_read;
#else // BC_ENABLED
#define BC_PARSE_NO_EXEC(p) (0)
#endif // BC_ENABLED
#endif // BC_BC_H

View File

@ -383,6 +383,7 @@ build_set() {
clang_flags="-Weverything -Wno-padded -Wno-switch-enum -Wno-format-nonliteral"
clang_flags="$clang_flags -Wno-cast-align -Wno-missing-noreturn -Wno-disabled-macro-expansion"
clang_flags="$clang_flags -Wno-unreachable-code -Wno-unreachable-code-return"
clang_flags="$clang_flags -Wno-implicit-fallthrough"
gcc_flags="-Wno-maybe-uninitialized -Wno-clobbered"
cflags="-Wall -Wextra -Werror -pedantic -Wno-conditional-uninitialized"

View File

@ -141,8 +141,8 @@ const char* const bc_err_msgs[] = {
"empty expression",
"bad print statement",
"bad function definition",
"bad assignment: left side must be scale, ibase, "
"obase, seed, last, var, or array element",
("bad assignment: left side must be scale, ibase, "
"obase, seed, last, var, or array element"),
"no auto variable found",
"function parameter or auto \"%s%s\" already exists",
"block end cannot be found",

View File

@ -1457,7 +1457,8 @@ static void bc_num_parseDecimal(BcNum *restrict n, const char *restrict val) {
for (i = 0; i < len && (zero = (val[i] == '0' || val[i] == '.')); ++i);
n->scale = (size_t) (rdx * ((val + len) - (ptr + 1)));
n->scale = (size_t) (rdx * (((uintptr_t) (val + len)) -
(((uintptr_t) ptr) + 1)));
n->rdx = BC_NUM_RDX(n->scale);
i = len - (ptr == val ? 0 : i) - rdx;
@ -1656,7 +1657,7 @@ static void bc_num_printDecimal(const BcNum *restrict n) {
memset(buffer, 0, BC_BASE_DIGS * sizeof(size_t));
for (j = 0; n9 && j < BC_BASE_DIGS; ++j) {
buffer[j] = n9 % BC_BASE;
buffer[j] = ((size_t) n9) % BC_BASE;
n9 /= BC_BASE;
}