From c1ffff3c531404a8d64fc12c8df11a68ebd56d13 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Mon, 5 May 2025 10:45:15 -0300 Subject: [PATCH] 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' --- sysdeps/ieee754/ldbl-128/s_roundl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.47.2