]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
math: Fix UB in ldbl-128 rintl
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 5 May 2025 13:37:35 +0000 (10:37 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 8 May 2025 12:25:49 +0000 (09:25 -0300)
UBSAN: Undefined behaviour in ../sysdeps/ieee754/float128/../ldbl-128/s_rintl.c:60:4 left shift of 1 by 63 cannot be represented in type 'long int'

sysdeps/ieee754/ldbl-128/s_rintl.c

index 072ed8ec15e18e479571ae724868b5536fecbf42..9236105a2af846f4fb32680e6f325ed6dc73b416 100644 (file)
@@ -44,7 +44,8 @@ __rintl (_Float128 x)
                 5.19229685853482762853049632922009600E+33L, /* 0x406F000000000000, 0 */
                 -5.19229685853482762853049632922009600E+33L  /* 0xC06F000000000000, 0 */
   };
-  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);