aboutsummaryrefslogtreecommitdiffstats
path: root/toolchain/musl/patches/048-math-fix-pow-signed-shift-ub.patch
diff options
context:
space:
mode:
authorKoen Vandeputte <koen.vandeputte@ncentric.com>2016-12-22 17:17:04 +0100
committerFelix Fietkau <nbd@nbd.name>2016-12-26 11:17:33 +0100
commit2912f9f2a2e5997df069d38e20d85ff4cc51acef (patch)
tree783e8cd472936ac1ca9378f16fb3189a486e7a48 /toolchain/musl/patches/048-math-fix-pow-signed-shift-ub.patch
parentb97c933ffb5aae338351a1db12a3f7cf5234f5c7 (diff)
downloadupstream-2912f9f2a2e5997df069d38e20d85ff4cc51acef.tar.gz
upstream-2912f9f2a2e5997df069d38e20d85ff4cc51acef.tar.bz2
upstream-2912f9f2a2e5997df069d38e20d85ff4cc51acef.zip
musl: backport various post-1.1.15 fixes
Backport most important fixes up to latest HEAD - Taken post-commit reverts/fixes into account Compile tested Run-tested on cns3xxx & imx6 targets Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Diffstat (limited to 'toolchain/musl/patches/048-math-fix-pow-signed-shift-ub.patch')
-rw-r--r--toolchain/musl/patches/048-math-fix-pow-signed-shift-ub.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/toolchain/musl/patches/048-math-fix-pow-signed-shift-ub.patch b/toolchain/musl/patches/048-math-fix-pow-signed-shift-ub.patch
new file mode 100644
index 0000000000..fde857b213
--- /dev/null
+++ b/toolchain/musl/patches/048-math-fix-pow-signed-shift-ub.patch
@@ -0,0 +1,38 @@
+From 688d3da0f1730daddbc954bbc2d27cc96ceee04c Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <nsz@port70.net>
+Date: Tue, 4 Oct 2016 03:58:56 +0200
+Subject: math: fix pow signed shift ub
+
+j is int32_t and thus j<<31 is undefined if j==1, so j is changed to
+uint32_t locally as a quick fix, the generated code is not affected.
+
+(this is a strict conformance fix, future c standard may allow 1<<31,
+see DR 463. the bug was inherited from freebsd fdlibm, the proper fix
+is to use uint32_t for all bit hacks, but that requires more intrusive
+changes.)
+
+reported by Daniel Sabogal
+---
+ src/math/pow.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/math/pow.c b/src/math/pow.c
+index b66f632..3ddc1b6 100644
+--- a/src/math/pow.c
++++ b/src/math/pow.c
+@@ -125,11 +125,11 @@ double pow(double x, double y)
+ else if (iy >= 0x3ff00000) {
+ k = (iy>>20) - 0x3ff; /* exponent */
+ if (k > 20) {
+- j = ly>>(52-k);
++ uint32_t j = ly>>(52-k);
+ if ((j<<(52-k)) == ly)
+ yisint = 2 - (j&1);
+ } else if (ly == 0) {
+- j = iy>>(20-k);
++ uint32_t j = iy>>(20-k);
+ if ((j<<(20-k)) == iy)
+ yisint = 2 - (j&1);
+ }
+--
+cgit v0.11.2