Date: Mon, 7 Jan 2019 17:35:09 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r342851 - head/lib/msun/src Message-ID: <201901071735.x07HZ9IF050748@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Mon Jan 7 17:35:09 2019 New Revision: 342851 URL: https://svnweb.freebsd.org/changeset/base/342851 Log: 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) Modified: head/lib/msun/src/e_pow.c Modified: head/lib/msun/src/e_pow.c ============================================================================== --- head/lib/msun/src/e_pow.c Mon Jan 7 16:36:45 2019 (r342850) +++ head/lib/msun/src/e_pow.c Mon Jan 7 17:35:09 2019 (r342851) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901071735.x07HZ9IF050748>