|
|
b6f14e |
Fixes regression introduced by glibc-rh1869380.patch. This fix
|
|
|
b6f14e |
backports the upstream fixed implementation of __isnanl to use only in
|
|
|
b6f14e |
printf_fp.c so that the fix remains localized and does not affect
|
|
|
b6f14e |
other callers of __isnanl.
|
|
|
b6f14e |
|
|
|
b6f14e |
diff --git a/include/math.h b/include/math.h
|
|
|
b6f14e |
index 0925d604ea3552a7..4eddc81be0dccad9 100644
|
|
|
b6f14e |
--- a/include/math.h
|
|
|
b6f14e |
+++ b/include/math.h
|
|
|
b6f14e |
@@ -6,6 +6,11 @@
|
|
|
b6f14e |
/* Now define the internal interfaces. */
|
|
|
b6f14e |
extern int __matherr (struct exception *__exc);
|
|
|
b6f14e |
|
|
|
b6f14e |
+# if IS_IN (libc)
|
|
|
b6f14e |
+extern int __isnanl_pseudo (long double);
|
|
|
b6f14e |
+hidden_proto (__isnanl_pseudo)
|
|
|
b6f14e |
+#endif
|
|
|
b6f14e |
+
|
|
|
b6f14e |
# if IS_IN (libc) || IS_IN (libm)
|
|
|
b6f14e |
hidden_proto (__finite)
|
|
|
b6f14e |
hidden_proto (__isinf)
|
|
|
b6f14e |
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
|
|
|
b6f14e |
index 60b143571065a082..af842156eaa3eace 100644
|
|
|
b6f14e |
--- a/stdio-common/printf_fp.c
|
|
|
b6f14e |
+++ b/stdio-common/printf_fp.c
|
|
|
b6f14e |
@@ -155,19 +155,7 @@ static __always_inline int
|
|
|
b6f14e |
isnanl_or_pseudo (long double in)
|
|
|
b6f14e |
{
|
|
|
b6f14e |
#if defined __x86_64__ || defined __i386__
|
|
|
b6f14e |
- union
|
|
|
b6f14e |
- {
|
|
|
b6f14e |
- long double f;
|
|
|
b6f14e |
- struct
|
|
|
b6f14e |
- {
|
|
|
b6f14e |
- uint64_t low;
|
|
|
b6f14e |
- uint64_t high;
|
|
|
b6f14e |
- } u;
|
|
|
b6f14e |
- } ldouble;
|
|
|
b6f14e |
-
|
|
|
b6f14e |
- ldouble.f = in;
|
|
|
b6f14e |
-
|
|
|
b6f14e |
- return __isnanl (in) || (ldouble.u.low & 0x8000000000000000) == 0;
|
|
|
b6f14e |
+ return __isnanl_pseudo (in);
|
|
|
b6f14e |
#else
|
|
|
b6f14e |
return __isnanl (in);
|
|
|
b6f14e |
#endif
|
|
|
b6f14e |
diff --git a/sysdeps/i386/fpu/s_isnanl.c b/sysdeps/i386/fpu/s_isnanl.c
|
|
|
b6f14e |
index 816396d8fbc79dde..dc83d7a85fb3318b 100644
|
|
|
b6f14e |
--- a/sysdeps/i386/fpu/s_isnanl.c
|
|
|
b6f14e |
+++ b/sysdeps/i386/fpu/s_isnanl.c
|
|
|
b6f14e |
@@ -41,3 +41,23 @@ int __isnanl(long double x)
|
|
|
b6f14e |
}
|
|
|
b6f14e |
hidden_def (__isnanl)
|
|
|
b6f14e |
weak_alias (__isnanl, isnanl)
|
|
|
b6f14e |
+
|
|
|
b6f14e |
+#if IS_IN (libc)
|
|
|
b6f14e |
+/* Exact backport from glibc-2.33, used only in printf_fp.c. */
|
|
|
b6f14e |
+int __isnanl_pseudo (long double x)
|
|
|
b6f14e |
+{
|
|
|
b6f14e |
+ int32_t se,hx,lx,pn;
|
|
|
b6f14e |
+ GET_LDOUBLE_WORDS(se,hx,lx,x);
|
|
|
b6f14e |
+ se = (se & 0x7fff) << 1;
|
|
|
b6f14e |
+ /* Detect pseudo-normal numbers, i.e. exponent is non-zero and the top
|
|
|
b6f14e |
+ bit of the significand is not set. */
|
|
|
b6f14e |
+ pn = (uint32_t)((~hx & 0x80000000) & (se|(-se)))>>31;
|
|
|
b6f14e |
+ /* Clear the significand bit when computing mantissa. */
|
|
|
b6f14e |
+ lx |= hx & 0x7fffffff;
|
|
|
b6f14e |
+ se |= (uint32_t)(lx|(-lx))>>31;
|
|
|
b6f14e |
+ se = 0xfffe - se;
|
|
|
b6f14e |
+
|
|
|
b6f14e |
+ return (int)(((uint32_t)(se)) >> 16) | pn;
|
|
|
b6f14e |
+}
|
|
|
b6f14e |
+hidden_def (__isnanl_pseudo)
|
|
|
b6f14e |
+#endif
|