mirror of git://sourceware.org/git/glibc.git
math: Fix UB in ldbl-128 lrintl
$ math/test-float128-llrint UBSAN: Undefined behaviour in ../sysdeps/ieee754/float128/../ldbl-128/s_llrintl.c:83:31 left shift of 281474976710656 by 15 cannot be represented in type 'long long int' Aborted UBSAN: Undefined behaviour in ../sysdeps/ieee754/float128/../ldbl-128/s_lrintl.c:111:30 left shift of 281474976710656 by 15 cannot be represented in type 'long int' Aborted
This commit is contained in:
parent
c1540fcdde
commit
712ff06cd6
|
|
@ -81,7 +81,7 @@ __lrintl (_Float128 x)
|
|||
result = (j0 < 0 ? 0 : i0 >> (48 - j0));
|
||||
}
|
||||
else if (j0 >= 112)
|
||||
result = ((long int) i0 << (j0 - 48)) | (i1 << (j0 - 112));
|
||||
result = (i0 << (j0 - 48)) | (i1 << (j0 - 112));
|
||||
else
|
||||
{
|
||||
#if defined FE_INVALID || defined FE_INEXACT
|
||||
|
|
@ -108,7 +108,7 @@ __lrintl (_Float128 x)
|
|||
if (j0 == 48)
|
||||
result = (long int) i0;
|
||||
else
|
||||
result = ((long int) i0 << (j0 - 48)) | (i1 >> (112 - j0));
|
||||
result = (i0 << (j0 - 48)) | (i1 >> (112 - j0));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in New Issue