From: Adhemerval Zanella Date: Mon, 5 May 2025 12:45:48 +0000 (-0300) Subject: math: Fix UB in ldbl-128 nearbyintl X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f65638ed1142ea68e07a345450d5c1f8b55fde3;p=thirdparty%2Fglibc.git math: Fix UB in ldbl-128 nearbyintl UBSAN: Undefined behaviour in ../sysdeps/ieee754/float128/../ldbl-128/s_nearbyintl.c:61:4 left shift of 1 by 63 cannot be represented in type 'long int' --- diff --git a/sysdeps/ieee754/ldbl-128/s_nearbyintl.c b/sysdeps/ieee754/ldbl-128/s_nearbyintl.c index d76d0155ad..b72ca2f016 100644 --- a/sysdeps/ieee754/ldbl-128/s_nearbyintl.c +++ b/sysdeps/ieee754/ldbl-128/s_nearbyintl.c @@ -42,7 +42,8 @@ __nearbyintl (_Float128 x) L(-5.19229685853482762853049632922009600E+33) /* 0xC06F000000000000, 0 */ }; fenv_t env; - int64_t i0, j0, sx; + int64_t i0, j0; + uint64_t sx; uint64_t i1 __attribute__ ((unused)); _Float128 w, t; GET_LDOUBLE_WORDS64 (i0, i1, x);