aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Eßer <se@FreeBSD.org>2020-10-01 15:40:24 +0000
committerStefan Eßer <se@FreeBSD.org>2020-10-01 15:40:24 +0000
commit9fef4b8de311c90cf35556217ec9e472c164f1a2 (patch)
treebe26a5882ff196a219183e684e983bfbd23f9055
parent592e97f5f6ed46b0e508b0be5511780ad9b336f6 (diff)
downloadsrc-9fef4b8de311c90cf35556217ec9e472c164f1a2.tar.gz
src-9fef4b8de311c90cf35556217ec9e472c164f1a2.zip
Update to version 3.1.6vendor/bc/3.1.6
Notes
Notes: svn path=/vendor/bc/dist/; revision=366316 svn path=/vendor/bc/3.1.6/; revision=366317; tag=vendor/bc/3.1.6
-rw-r--r--Makefile.in2
-rw-r--r--NEWS.md8
-rw-r--r--include/bc.h4
-rwxr-xr-xrelease.sh1
-rw-r--r--src/data.c4
-rw-r--r--src/num.c5
6 files changed, 19 insertions, 5 deletions
diff --git a/Makefile.in b/Makefile.in
index 3edc9ef16ec1..53f782c02791 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -29,7 +29,7 @@
#
.POSIX:
-VERSION = 3.1.5
+VERSION = 3.1.6
SRC = %%SRC%%
OBJ = %%OBJ%%
diff --git a/NEWS.md b/NEWS.md
index 6d36f300d2b8..af7f21c48fa6 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -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`
diff --git a/include/bc.h b/include/bc.h
index 4423525bad3e..383e7e7ec562 100644
--- a/include/bc.h
+++ b/include/bc.h
@@ -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
diff --git a/release.sh b/release.sh
index 06663b998f72..d6cc74b43118 100755
--- a/release.sh
+++ b/release.sh
@@ -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"
diff --git a/src/data.c b/src/data.c
index 2556f795eed6..039c83e1cac1 100644
--- a/src/data.c
+++ b/src/data.c
@@ -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",
diff --git a/src/num.c b/src/num.c
index 05b4654f21f5..de5fa5c566fb 100644
--- a/src/num.c
+++ b/src/num.c
@@ -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;
}