From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2134) id 5061B3858C31; Thu, 13 Apr 2023 17:37:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5061B3858C31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681407426; bh=WbeR55xVnSOafkT2G2vdj4aKrRchuPH6WGZC3mKoL0g=; h=From:To:Subject:Date:From; b=YQEtJNHloYub89aggzuVM+SjI7EJ2cVVJ5u+MK9HmO49TeQgZvgEEmq238bGedttG +Vt5RTJNslMuDnwfw7AP4sLHCiO2og7/T+oWHCH7387JlOy2Iij0BmCJ/LFVrffy48 E7MRetSOKwRePU0mBg8wzfT8Us5CYwoMuzQ+E/6k= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jeff Johnston To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Compare j as unsigned X-Act-Checkin: newlib-cygwin X-Git-Author: Andoni Arregi X-Git-Refname: refs/heads/master X-Git-Oldrev: e5a36e6af7c52b70fbc8c11a888220d8579e0275 X-Git-Newrev: 9e89e667299a1f17572930b45661ce98afca76c8 Message-Id: <20230413173706.5061B3858C31@sourceware.org> Date: Thu, 13 Apr 2023 17:37:06 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D9e89e667299= a1f17572930b45661ce98afca76c8 commit 9e89e667299a1f17572930b45661ce98afca76c8 Author: Andoni Arregi Date: Wed Apr 12 17:34:44 2023 +0200 Compare j as unsigned =20 j is int32_t and thus j<<31 is undefined if j=3D=3D1. =20 Taken from FreeBSD commit bdd8abc6d6a93ce3ab8ad5db716222ee3110c4a3 Diff: --- newlib/libm/math/e_pow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libm/math/e_pow.c b/newlib/libm/math/e_pow.c index f24a98f6e..0e2251f10 100644 --- a/newlib/libm/math/e_pow.c +++ b/newlib/libm/math/e_pow.c @@ -141,7 +141,7 @@ ivln2_l =3D 1.92596299112661746887e-08; /* 0x3E54AE0B= , 0xF85DDF44 =3D1/ln2 tail*/ k =3D (iy>>20)-0x3ff; /* exponent */ if(k>20) { j =3D ly>>(52-k); - if((j<<(52-k))=3D=3Dly) yisint =3D 2-(j&1); + if(((uint32_t)j<<(52-k))=3D=3Dly) yisint =3D 2-(j&1); } else if(ly=3D=3D0) { j =3D iy>>(20-k); if((j<<(20-k))=3D=3Diy) yisint =3D 2-(j&1);