forked from rpms/glibc
ad85e10075
Upstream commit: commit 6484ae5b8c4d4314f748e4d3c9a9baa5385e57c5 - malloc: Fix -Wuse-after-free warning in tst-mallocalign1 [BZ #26779] - s_sincosf.h: Change pio4 type to float [BZ #28713] - math: Properly cast X_TLOSS to float [BZ #28713] - Regenerate ulps on x86_64 with GCC 12 - Avoid -Wuse-after-free in tests [BZ #26779]. - Fix build of nptl/tst-thread_local1.cc with GCC 12 - Fix stdio-common tests for GCC 12 -Waddress - Fix stdlib/tst-setcontext.c for GCC 12 -Warray-compare - resolv: Avoid GCC 12 false positive warning [BZ #28439]. - intl: Avoid -Wuse-after-free [BZ #26779] - elf: Drop elf/tls-macros.h in favor of __thread and tls_model attributes [BZ #28152] [BZ #28205] - time: Set daylight to 1 for matching DST/offset change (RHBZ#2155352) - elf/tst-tlsopt-powerpc fails when compiled with -mcpu=power10 (BZ# 29776) - time: Use 64 bit time on tzfile - nscd: Use 64 bit time_t on libc nscd routines (BZ# 29402) - nis: Build libnsl with 64 bit time_t - Use LFS and 64 bit time for installed programs (BZ #15333) Resolves: #2155352 Related: #2160734
112 lines
3.5 KiB
Diff
112 lines
3.5 KiB
Diff
commit 80b24b86548eee3d96130a48e760d1d6c2e0c587
|
|
Author: H.J. Lu <hjl.tools@gmail.com>
|
|
Date: Mon Dec 20 15:00:24 2021 -0800
|
|
|
|
math: Properly cast X_TLOSS to float [BZ #28713]
|
|
|
|
Add
|
|
|
|
#define AS_FLOAT_CONSTANT_1(x) x##f
|
|
#define AS_FLOAT_CONSTANT(x) AS_FLOAT_CONSTANT_1(x)
|
|
|
|
to cast X_TLOSS to float at compile-time to fix:
|
|
|
|
FAIL: math/test-float-j0
|
|
FAIL: math/test-float-jn
|
|
FAIL: math/test-float-y0
|
|
FAIL: math/test-float-y1
|
|
FAIL: math/test-float-yn
|
|
FAIL: math/test-float32-j0
|
|
FAIL: math/test-float32-jn
|
|
FAIL: math/test-float32-y0
|
|
FAIL: math/test-float32-y1
|
|
FAIL: math/test-float32-yn
|
|
|
|
when compiling with GCC 12.
|
|
|
|
Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
|
|
(cherry picked from commit 6e30181b4a3ab6c56da0378b65f4d60504982300)
|
|
|
|
diff --git a/math/math-svid-compat.h b/math/math-svid-compat.h
|
|
index 5c18cb1b039cb3be..876cadde4084dab0 100644
|
|
--- a/math/math-svid-compat.h
|
|
+++ b/math/math-svid-compat.h
|
|
@@ -49,6 +49,8 @@ extern int matherr (struct exception *__exc);
|
|
extern int __matherr (struct exception *__exc);
|
|
|
|
#define X_TLOSS 1.41484755040568800000e+16
|
|
+#define AS_FLOAT_CONSTANT_1(x) x##f
|
|
+#define AS_FLOAT_CONSTANT(x) AS_FLOAT_CONSTANT_1(x)
|
|
|
|
/* Types of exceptions in the `type' field. */
|
|
#define DOMAIN 1
|
|
diff --git a/math/w_j0f_compat.c b/math/w_j0f_compat.c
|
|
index a4882eadb33853b2..f35a55219f7baa78 100644
|
|
--- a/math/w_j0f_compat.c
|
|
+++ b/math/w_j0f_compat.c
|
|
@@ -28,7 +28,8 @@
|
|
float
|
|
__j0f (float x)
|
|
{
|
|
- if (__builtin_expect (isgreater (fabsf (x), (float) X_TLOSS), 0)
|
|
+ if (__builtin_expect (isgreater (fabsf (x),
|
|
+ AS_FLOAT_CONSTANT (X_TLOSS)), 0)
|
|
&& _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
|
|
/* j0(|x|>X_TLOSS) */
|
|
return __kernel_standard_f (x, x, 134);
|
|
@@ -43,7 +44,7 @@ float
|
|
__y0f (float x)
|
|
{
|
|
if (__builtin_expect (islessequal (x, 0.0f)
|
|
- || isgreater (x, (float) X_TLOSS), 0)
|
|
+ || isgreater (x, AS_FLOAT_CONSTANT (X_TLOSS)), 0)
|
|
&& _LIB_VERSION != _IEEE_)
|
|
{
|
|
if (x < 0.0f)
|
|
diff --git a/math/w_j1f_compat.c b/math/w_j1f_compat.c
|
|
index f2ec7b327d2bc90a..c5e3ccd035031799 100644
|
|
--- a/math/w_j1f_compat.c
|
|
+++ b/math/w_j1f_compat.c
|
|
@@ -28,7 +28,8 @@
|
|
float
|
|
__j1f (float x)
|
|
{
|
|
- if (__builtin_expect (isgreater (fabsf (x), X_TLOSS), 0)
|
|
+ if (__builtin_expect (isgreater (fabsf (x),
|
|
+ AS_FLOAT_CONSTANT (X_TLOSS)), 0)
|
|
&& _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
|
|
/* j1(|x|>X_TLOSS) */
|
|
return __kernel_standard_f (x, x, 136);
|
|
@@ -43,7 +44,7 @@ float
|
|
__y1f (float x)
|
|
{
|
|
if (__builtin_expect (islessequal (x, 0.0f)
|
|
- || isgreater (x, (float) X_TLOSS), 0)
|
|
+ || isgreater (x, AS_FLOAT_CONSTANT (X_TLOSS)), 0)
|
|
&& _LIB_VERSION != _IEEE_)
|
|
{
|
|
if (x < 0.0f)
|
|
diff --git a/math/w_jnf_compat.c b/math/w_jnf_compat.c
|
|
index fb6e5060096fb070..925ccc4cd0988a8f 100644
|
|
--- a/math/w_jnf_compat.c
|
|
+++ b/math/w_jnf_compat.c
|
|
@@ -28,7 +28,8 @@
|
|
float
|
|
__jnf (int n, float x)
|
|
{
|
|
- if (__builtin_expect (isgreater (fabsf (x), (float) X_TLOSS), 0)
|
|
+ if (__builtin_expect (isgreater (fabsf (x),
|
|
+ AS_FLOAT_CONSTANT (X_TLOSS)), 0)
|
|
&& _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
|
|
/* jn(n,|x|>X_TLOSS) */
|
|
return __kernel_standard_f (n, x, 138);
|
|
@@ -43,7 +44,7 @@ float
|
|
__ynf (int n, float x)
|
|
{
|
|
if (__builtin_expect (islessequal (x, 0.0f)
|
|
- || isgreater (x, (float) X_TLOSS), 0)
|
|
+ || isgreater (x, AS_FLOAT_CONSTANT (X_TLOSS)), 0)
|
|
&& _LIB_VERSION != _IEEE_)
|
|
{
|
|
if (x < 0.0f)
|