aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2018-05-22 16:55:04 +0000
committerJoseph Myers <joseph@codesourcery.com>2018-05-22 16:55:04 +0000
commit3d6302a5467035077ecfe02cdb73d3d467a9e004 (patch)
tree64a256575c4e05be204e64efc51e55aacb9dc548
parent5c5c0dd747070db624c8e2c43691cec854f114ef (diff)
downloadglibc-3d6302a5467035077ecfe02cdb73d3d467a9e004.tar
glibc-3d6302a5467035077ecfe02cdb73d3d467a9e004.tar.gz
glibc-3d6302a5467035077ecfe02cdb73d3d467a9e004.tar.bz2
glibc-3d6302a5467035077ecfe02cdb73d3d467a9e004.zip
Fix i686-linux-gnu build with GCC mainline.
Building with recent GCC mainline for i686-linux-gnu is failing with: ../sysdeps/ieee754/flt-32/k_rem_pio2f.c: In function '__kernel_rem_pio2f': ../sysdeps/ieee754/flt-32/k_rem_pio2f.c:186:28: error: 'fq[0]' may be used uninitialized in this function [-Werror=maybe-uninitialized] fv = math_narrow_eval (fq[0]-fv); ^ and ../sysdeps/ieee754/dbl-64/k_rem_pio2.c: In function '__kernel_rem_pio2': ../sysdeps/ieee754/dbl-64/k_rem_pio2.c:333:32: error: 'fq[0]' may be used uninitialized in this function [-Werror=maybe-uninitialized] fv = math_narrow_eval (fq[0] - fv); ^ These are similar to -Warray-bounds cases for which the DIAG_* macros are already used in those files: the array element is in fact always initialized, but the reasoning that it is depends on another array not having been all zero at an earlier point, which depends on the functions not being called with zero arguments. Thus, this patch uses DIAG_* to disable -Wmaybe-uninitialized for this code. (The warning may be i686-specific because of math_narrow_eval somehow perturbing what the compiler does with this code enough to cause the warning. I don't know why it doesn't appear for i686-gnu.) Tested with build-many-glibcs.py that this fixes the i686 build in this configuration. * sysdeps/ieee754/dbl-64/k_rem_pio2.c (__kernel_rem_pio2): Ignore -Wmaybe-uninitialized around access to fq[0]. * sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f): Likewise.
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/ieee754/dbl-64/k_rem_pio2.c9
-rw-r--r--sysdeps/ieee754/flt-32/k_rem_pio2f.c10
3 files changed, 24 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 6c9331b894..f11b1c2bc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2018-05-22 Joseph Myers <joseph@codesourcery.com>
+ * sysdeps/ieee754/dbl-64/k_rem_pio2.c (__kernel_rem_pio2): Ignore
+ -Wmaybe-uninitialized around access to fq[0].
+ * sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
+ Likewise.
+
[BZ #18471]
* sysdeps/unix/make-syscalls.sh (emit_weak_aliases): Use weak
aliases for non-libc case of versioned symbols.
diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index 820fe7787e..d8403dc345 100644
--- a/sysdeps/ieee754/dbl-64/k_rem_pio2.c
+++ b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
@@ -330,7 +330,16 @@ recompute:
for (i = jz; i >= 0; i--)
fv = math_narrow_eval (fv + fq[i]);
y[0] = (ih == 0) ? fv : -fv;
+ /* GCC mainline (to be GCC 9), as of 2018-05-22 on i686, warns
+ that fq[0] may be used uninitialized. This is not possible
+ because jz is always nonnegative when the above loop
+ initializing fq is executed, because the result is never zero
+ to full precision (this function is not called for zero
+ arguments). */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
fv = math_narrow_eval (fq[0] - fv);
+ DIAG_POP_NEEDS_COMMENT;
for (i = 1; i <= jz; i++)
fv = math_narrow_eval (fv + fq[i]);
y[1] = (ih == 0) ? fv : -fv;
diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
index fdf2b5da2c..ea4915b765 100644
--- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
@@ -183,7 +183,17 @@ recompute:
float fv = 0.0;
for (i=jz;i>=0;i--) fv = math_narrow_eval (fv + fq[i]);
y[0] = (ih==0)? fv: -fv;
+ /* GCC mainline (to be GCC 9), as of 2018-05-22 on
+ i686, warns that fq[0] may be used uninitialized.
+ This is not possible because jz is always
+ nonnegative when the above loop initializing fq is
+ executed, because the result is never zero to full
+ precision (this function is not called for zero
+ arguments). */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
fv = math_narrow_eval (fq[0]-fv);
+ DIAG_POP_NEEDS_COMMENT;
for (i=1;i<=jz;i++) fv = math_narrow_eval (fv + fq[i]);
y[1] = (ih==0)? fv: -fv;
break;