From: Adhemerval Zanella Date: Tue, 6 May 2025 11:43:19 +0000 (+0000) Subject: math: Fix UB in dbl-64 lrint X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48557d36a060c6ae1a0387529ec879ad74bafd57;p=thirdparty%2Fglibc.git math: Fix UB in dbl-64 lrint UBSAN: Undefined behaviour in ../sysdeps/ieee754/dbl-64/s_lrint.c:99:30 left shift of 1048576 by 11 cannot be represented in type 'long int' --- diff --git a/sysdeps/ieee754/dbl-64/s_lrint.c b/sysdeps/ieee754/dbl-64/s_lrint.c index 980959292e..a3cd9ca756 100644 --- a/sysdeps/ieee754/dbl-64/s_lrint.c +++ b/sysdeps/ieee754/dbl-64/s_lrint.c @@ -95,7 +95,7 @@ __lrint (double x) if (j0 == 20) result = (long int) i0; else - result = ((long int) i0 << (j0 - 20)) | (i1 >> (52 - j0)); + result = (i0 << (j0 - 20)) | (i1 >> (52 - j0)); } } else