From 9f65638ed1142ea68e07a345450d5c1f8b55fde3 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Mon, 5 May 2025 09:45:48 -0300 Subject: [PATCH] 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' --- sysdeps/ieee754/ldbl-128/s_nearbyintl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.47.2