From: Adhemerval Zanella Date: Mon, 5 May 2025 13:48:40 +0000 (-0300) Subject: math: Fix UB in ldbl-128 powl X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8175ef182f0645a91be6035d245727b797776c59;p=thirdparty%2Fglibc.git math: Fix UB in ldbl-128 powl testing _Float128 (without inline functions) UBSAN: Undefined behaviour in ../sysdeps/ieee754/float128/../ldbl-128/e_powl.c:439:11 left shift of 4294953849 by 16 cannot be represented in type 'int' --- diff --git a/sysdeps/ieee754/ldbl-128/e_powl.c b/sysdeps/ieee754/ldbl-128/e_powl.c index 4e20616705..cec2e9990b 100644 --- a/sysdeps/ieee754/ldbl-128/e_powl.c +++ b/sysdeps/ieee754/ldbl-128/e_powl.c @@ -436,7 +436,7 @@ __ieee754_powl (_Float128 x, _Float128 y) z = one - (r - z); o.value = z; j = o.parts32.w0; - j += (n << 16); + j += ((uint32_t)n << 16); if ((j >> 16) <= 0) { z = __scalbnl (z, n); /* subnormal output */