aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@wdc.com>2019-04-30 02:24:49 +0100
committerMaciej W. Rozycki <macro@wdc.com>2019-04-30 02:24:49 +0100
commit87c266d758d29e52bfb717f90025ef1fe2663d38 (patch)
tree181e7d8204167f33cc171887a20cffebfcd4e9d0
parent6cac323c8dd78668e65aaa29f044cbd33c1a66a5 (diff)
downloadglibc-87c266d758d29e52bfb717f90025ef1fe2663d38.zip
glibc-87c266d758d29e52bfb717f90025ef1fe2663d38.tar.gz
glibc-87c266d758d29e52bfb717f90025ef1fe2663d38.tar.bz2
Fix -O1 compilation errors with `__ddivl' and `__fdivl' [BZ #19444]
Complementing commit 4a06ceea33ec ("sysdeps/ieee754/soft-fp: ignore maybe-uninitialized with -O [BZ #19444]") and commit 27c5e756a2a8 ("sysdeps/ieee754: prevent maybe-uninitialized errors with -O [BZ #19444]") also fix compilation errors observed at -O1 in `__ddivl' and `__fdivl' with GCC 9 and RISC-V targets: In file included from ../soft-fp/soft-fp.h:318, from ../sysdeps/ieee754/soft-fp/s_fdivl.c:27: ../sysdeps/ieee754/soft-fp/s_fdivl.c: In function '__fdivl': ../soft-fp/op-2.h:108:9: error: 'R_f1' may be used uninitialized in this function [-Werror=maybe-uninitialized] 108 | : (X##_f1 << (2*_FP_W_TYPE_SIZE - (N)))) \ | ^ ../sysdeps/ieee754/soft-fp/s_fdivl.c:37:14: note: 'R_f1' was declared here 37 | FP_DECL_Q (R); | ^ ../soft-fp/op-common.h:39:3: note: in expansion of macro '_FP_FRAC_DECL_2' 39 | _FP_FRAC_DECL_##wc (X) | ^~~~~~~~~~~~~~ ../soft-fp/quad.h:226:24: note: in expansion of macro '_FP_DECL' 226 | # define FP_DECL_Q(X) _FP_DECL (2, X) | ^~~~~~~~ ../sysdeps/ieee754/soft-fp/s_fdivl.c:37:3: note: in expansion of macro 'FP_DECL_Q' 37 | FP_DECL_Q (R); | ^~~~~~~~~ ../soft-fp/op-2.h:109:8: error: 'R_f0' may be used uninitialized in this function [-Werror=maybe-uninitialized] 109 | | X##_f0) != 0)); \ | ^ ../sysdeps/ieee754/soft-fp/s_fdivl.c:37:14: note: 'R_f0' was declared here 37 | FP_DECL_Q (R); | ^ ../soft-fp/op-common.h:39:3: note: in expansion of macro '_FP_FRAC_DECL_2' 39 | _FP_FRAC_DECL_##wc (X) | ^~~~~~~~~~~~~~ ../soft-fp/quad.h:226:24: note: in expansion of macro '_FP_DECL' 226 | # define FP_DECL_Q(X) _FP_DECL (2, X) | ^~~~~~~~ ../sysdeps/ieee754/soft-fp/s_fdivl.c:37:3: note: in expansion of macro 'FP_DECL_Q' 37 | FP_DECL_Q (R); | ^~~~~~~~~ In file included from ../soft-fp/soft-fp.h:318, from ../sysdeps/ieee754/soft-fp/s_ddivl.c:31: ../sysdeps/ieee754/soft-fp/s_ddivl.c: In function '__ddivl': ../soft-fp/op-2.h:98:25: error: 'R_f1' may be used uninitialized in this function [-Werror=maybe-uninitialized] 98 | X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N) \ | ^~ ../sysdeps/ieee754/soft-fp/s_ddivl.c:41:14: note: 'R_f1' was declared here 41 | FP_DECL_Q (R); | ^ ../soft-fp/op-2.h:37:36: note: in definition of macro '_FP_FRAC_DECL_2' 37 | _FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT | ^ ../soft-fp/quad.h:226:24: note: in expansion of macro '_FP_DECL' 226 | # define FP_DECL_Q(X) _FP_DECL (2, X) | ^~~~~~~~ ../sysdeps/ieee754/soft-fp/s_ddivl.c:41:3: note: in expansion of macro 'FP_DECL_Q' 41 | FP_DECL_Q (R); | ^~~~~~~~~ ../soft-fp/op-2.h:101:17: error: 'R_f0' may be used uninitialized in this function [-Werror=maybe-uninitialized] 101 | : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0)); \ | ^~ ../sysdeps/ieee754/soft-fp/s_ddivl.c:41:14: note: 'R_f0' was declared here 41 | FP_DECL_Q (R); | ^ ../soft-fp/op-2.h:37:14: note: in definition of macro '_FP_FRAC_DECL_2' 37 | _FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT | ^ ../soft-fp/quad.h:226:24: note: in expansion of macro '_FP_DECL' 226 | # define FP_DECL_Q(X) _FP_DECL (2, X) | ^~~~~~~~ ../sysdeps/ieee754/soft-fp/s_ddivl.c:41:3: note: in expansion of macro 'FP_DECL_Q' 41 | FP_DECL_Q (R); | ^~~~~~~~~ cc1: all warnings being treated as errors make[2]: *** [.../sysd-rules:587: .../math/s_fdivl.o] Error 1 make[2]: *** Waiting for unfinished jobs.... cc1: all warnings being treated as errors make[2]: *** [.../sysd-rules:587: .../math/s_ddivl.o] Error 1 This comes from cases in _FP_DIV that return a result described as FP_CLS_ZERO or FP_CLS_INF and do not initialize the fractional part, which is then operated on unconditionally in FP_TRUNC_COOKED before being ignored by _FP_PACK_CANONICAL. Clearly at this optimization level GCC cannot guarantee to be able to determine that the fractional part is ultimately unused, so ignore the error as with the earlier commits referred, letting compilation proceed. [BZ #19444] * sysdeps/ieee754/soft-fp/s_ddivl.c (__ddivl): Ignore errors from `-Wmaybe-uninitialized'. * sysdeps/ieee754/soft-fp/s_fdivl.c (__fdivl): Likewise.
-rw-r--r--ChangeLog7
-rw-r--r--sysdeps/ieee754/soft-fp/s_ddivl.c12
-rw-r--r--sysdeps/ieee754/soft-fp/s_fdivl.c12
3 files changed, 31 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 6db6889..b2da915 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2019-04-30 Maciej W. Rozycki <macro@wdc.com>
+
+ [BZ #19444]
+ * sysdeps/ieee754/soft-fp/s_ddivl.c (__ddivl): Ignore errors
+ from `-Wmaybe-uninitialized'.
+ * sysdeps/ieee754/soft-fp/s_fdivl.c (__fdivl): Likewise.
+
2019-04-29 Adhemerval Zanella <adhemerval.zanella@linaro.org>
* sysdeps/powerpc/fpu/fenv_libc.h (__fesetround_inline_nocheck): New
diff --git a/sysdeps/ieee754/soft-fp/s_ddivl.c b/sysdeps/ieee754/soft-fp/s_ddivl.c
index 8e469c5..1af34e1 100644
--- a/sysdeps/ieee754/soft-fp/s_ddivl.c
+++ b/sysdeps/ieee754/soft-fp/s_ddivl.c
@@ -28,6 +28,16 @@
#undef f64divf128
#include <math-narrow.h>
+#include <libc-diag.h>
+
+/* R_f[01] are not set in cases where they are not used in packing,
+ but the compiler does not see that they are set in all cases where
+ they are used, resulting in warnings that they may be used
+ uninitialized. The location of the warning differs in different
+ versions of GCC, it may be where R is defined using a macro or it
+ may be where the macro is defined. This happens only with -O1. */
+DIAG_PUSH_NEEDS_COMMENT;
+DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
#include <soft-fp.h>
#include <double.h>
#include <quad.h>
@@ -56,4 +66,6 @@ __ddivl (_Float128 x, _Float128 y)
CHECK_NARROW_DIV (ret, x, y);
return ret;
}
+DIAG_POP_NEEDS_COMMENT;
+
libm_alias_double_ldouble (div)
diff --git a/sysdeps/ieee754/soft-fp/s_fdivl.c b/sysdeps/ieee754/soft-fp/s_fdivl.c
index 4792b23..b7a5a41 100644
--- a/sysdeps/ieee754/soft-fp/s_fdivl.c
+++ b/sysdeps/ieee754/soft-fp/s_fdivl.c
@@ -24,6 +24,16 @@
#undef f32divf128
#include <math-narrow.h>
+#include <libc-diag.h>
+
+/* R_f[01] are not set in cases where they are not used in packing,
+ but the compiler does not see that they are set in all cases where
+ they are used, resulting in warnings that they may be used
+ uninitialized. The location of the warning differs in different
+ versions of GCC, it may be where R is defined using a macro or it
+ may be where the macro is defined. This happens only with -O1. */
+DIAG_PUSH_NEEDS_COMMENT;
+DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
#include <soft-fp.h>
#include <single.h>
#include <quad.h>
@@ -52,4 +62,6 @@ __fdivl (_Float128 x, _Float128 y)
CHECK_NARROW_DIV (ret, x, y);
return ret;
}
+DIAG_POP_NEEDS_COMMENT;
+
libm_alias_float_ldouble (div)