From: Adhemerval Zanella Date: Mon, 5 May 2025 13:45:15 +0000 (-0300) Subject: math: Fix UB in ldbl-128 roundl X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1ffff3c531404a8d64fc12c8df11a68ebd56d13;p=thirdparty%2Fglibc.git math: Fix UB in ldbl-128 roundl $ math/test-float128-cospi testing _Float128 (without inline functions) UBSAN: Undefined behaviour in ../sysdeps/ieee754/float128/../ldbl-128/s_roundl.c:75:30 left shift of 1 by 63 cannot be represented in type 'long long int' --- diff --git a/sysdeps/ieee754/ldbl-128/s_roundl.c b/sysdeps/ieee754/ldbl-128/s_roundl.c index 9a87a463e8..aa02e3c9c6 100644 --- a/sysdeps/ieee754/ldbl-128/s_roundl.c +++ b/sysdeps/ieee754/ldbl-128/s_roundl.c @@ -72,7 +72,7 @@ __roundl (_Float128 x) /* X is integral. */ return x; - uint64_t j = i1 + (1LL << (111 - j0)); + uint64_t j = i1 + (1ULL << (111 - j0)); if (j < i1) i0 += 1; i1 = j;