summaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/flt-32/k_rem_pio2f.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/flt-32/k_rem_pio2f.c')
-rw-r--r--sysdeps/ieee754/flt-32/k_rem_pio2f.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
index 392afdbb6c..ea4915b765 100644
--- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
@@ -18,7 +18,9 @@ static char rcsid[] = "$NetBSD: k_rem_pio2f.c,v 1.4 1995/05/10 20:46:28 jtc Exp
#endif
#include <math.h>
+#include <math-narrow-eval.h>
#include <math_private.h>
+#include <libc-diag.h>
/* In the float version, the input parameter x contains 8 bit
integers, not 24 bit integers. 113 bit precision is not supported. */
@@ -122,7 +124,16 @@ recompute:
j = 0;
for (i=jz-1;i>=jk;i--) j |= iq[i];
if(j==0) { /* need recomputation */
+ /* On s390x gcc 6.1 -O3 produces the warning "array subscript is
+ below array bounds [-Werror=array-bounds]". Only
+ __ieee754_rem_pio2f calls __kernel_rem_pio2f for normal
+ numbers and |x| ~> 2^7*(pi/2). Thus x can't be zero and
+ ipio2 is not zero, too. Thus not all iq[] values can't be
+ zero. */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (6.1, "-Warray-bounds");
for(k=1;iq[jk-k]==0;k++); /* k = no. of terms needed */
+ DIAG_POP_NEEDS_COMMENT;
for(i=jz+1;i<=jz+k;i++) { /* add q[jz+1] to q[jz+k] */
f[jx+i] = (float) ipio2[jv+i];
@@ -172,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;