aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754
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 /sysdeps/ieee754
parent5c5c0dd747070db624c8e2c43691cec854f114ef (diff)
downloadglibc-3d6302a5467035077ecfe02cdb73d3d467a9e004.zip
glibc-3d6302a5467035077ecfe02cdb73d3d467a9e004.tar.gz
glibc-3d6302a5467035077ecfe02cdb73d3d467a9e004.tar.bz2
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.
Diffstat (limited to 'sysdeps/ieee754')
-rw-r--r--sysdeps/ieee754/dbl-64/k_rem_pio2.c9
-rw-r--r--sysdeps/ieee754/flt-32/k_rem_pio2f.c10
2 files changed, 19 insertions, 0 deletions
diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index 820fe77..d8403dc 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 fdf2b5d..ea4915b 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;