aboutsummaryrefslogtreecommitdiff
path: root/lib/msun
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2019-01-07 17:35:09 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2019-01-07 17:35:09 +0000
commitbdd8abc6d6a93ce3ab8ad5db716222ee3110c4a3 (patch)
treea8e42977c0b34fd79d77c18b9f9f19349336eea5 /lib/msun
parented47d82f5949d6a693b92ec644ffbd6bca1aea8e (diff)
downloadsrc-bdd8abc6d6a93ce3ab8ad5db716222ee3110c4a3.tar.gz
src-bdd8abc6d6a93ce3ab8ad5db716222ee3110c4a3.zip
pow(3): Workaround possible signed shift Undefined Behavior.
j is int32_t and thus j<<31 is undefined if j==1. Hinted by: muusl-lib (git 688d3da0f1730daddbc954bbc2d27cc96ceee04c) Discussed with: freebsd-numerics (kargl)
Notes
Notes: svn path=/head/; revision=342851
Diffstat (limited to 'lib/msun')
-rw-r--r--lib/msun/src/e_pow.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/msun/src/e_pow.c b/lib/msun/src/e_pow.c
index 69ddb7ffcb48..52b2f5cebdbc 100644
--- a/lib/msun/src/e_pow.c
+++ b/lib/msun/src/e_pow.c
@@ -133,7 +133,7 @@ __ieee754_pow(double x, double y)
k = (iy>>20)-0x3ff; /* exponent */
if(k>20) {
j = ly>>(52-k);
- if((j<<(52-k))==ly) yisint = 2-(j&1);
+ if(((u_int32_t)j<<(52-k))==ly) yisint = 2-(j&1);
} else if(ly==0) {
j = iy>>(20-k);
if((j<<(20-k))==iy) yisint = 2-(j&1);