mirror of git://sourceware.org/git/glibc.git
math: Fix UB on lroundl
Building with --enable-ubasn triggers: $ math/test-ldouble-pow testing long double (without inline functions) UBSAN: Undefined behaviour in ../sysdeps/ieee754/ldbl-96/s_roundl.c:75:28 left shift of 1 by 31 cannot be represented in type 'int' Aborted
This commit is contained in:
parent
51a2a92502
commit
c949920ef6
|
@ -72,7 +72,7 @@ __roundl (long double x)
|
||||||
/* X is integral. */
|
/* X is integral. */
|
||||||
return x;
|
return x;
|
||||||
|
|
||||||
uint32_t j = i1 + (1 << (62 - j0));
|
uint32_t j = i1 + (1U << (62 - j0));
|
||||||
if (j < i1)
|
if (j < i1)
|
||||||
{
|
{
|
||||||
uint32_t k = i0 + 1;
|
uint32_t k = i0 + 1;
|
||||||
|
|
Loading…
Reference in New Issue