aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-05-19 18:40:25 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-05-19 18:40:25 +0000
commit3e694268750d51acc6a68b0ee7ded25a52902c20 (patch)
treedea529a863349fc82263de39b239742a00845031
parentdb62a9075305963281572cb990d1c766948bae7b (diff)
downloadglibc-3e694268750d51acc6a68b0ee7ded25a52902c20.zip
glibc-3e694268750d51acc6a68b0ee7ded25a52902c20.tar.gz
glibc-3e694268750d51acc6a68b0ee7ded25a52902c20.tar.bz2
Fix nearbyint scheduling of arithmetic past fesetenv (bug 15490).
-rw-r--r--ChangeLog12
-rw-r--r--NEWS2
-rw-r--r--sysdeps/ieee754/dbl-64/s_nearbyint.c2
-rw-r--r--sysdeps/ieee754/flt-32/s_nearbyintf.c2
-rw-r--r--sysdeps/ieee754/ldbl-128/s_nearbyintl.c2
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c5
-rw-r--r--sysdeps/ieee754/ldbl-96/s_nearbyintl.c2
7 files changed, 26 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 5967380..a2323fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2013-05-19 Joseph Myers <joseph@codesourcery.com>
+ [BZ #15490]
+ * sysdeps/ieee754/dbl-64/s_nearbyint.c (__nearbyint): Use
+ math_force_eval before restoring floating-point envrionment.
+ * sysdeps/ieee754/flt-32/s_nearbyintf.c (__nearbyintf): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_nearbyintl.c (__nearbyintl):
+ Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c: Include
+ <math_private.h>.
+ (__nearbyintl): Use math_force_eval before restoring
+ floating-point environment.
+ * sysdeps/ieee754/ldbl-96/s_nearbyintl.c (__nearbyintl): Likewise.
+
* math/gen-libm-test.pl (special_functions): Remove.
(parse_args): Don't handle TEST_extra. Handle functions with no
return value.
diff --git a/NEWS b/NEWS
index a2bac22..230b304 100644
--- a/NEWS
+++ b/NEWS
@@ -18,7 +18,7 @@ Version 2.18
15305, 15307, 15309, 15327, 15330, 15335, 15336, 15337, 15342, 15346,
15359, 15361, 15366, 15380, 15394, 15395, 15405, 15406, 15409, 15416,
15418, 15419, 15423, 15424, 15426, 15429, 15442, 15448, 15480, 15485,
- 15488.
+ 15488, 15490.
* CVE-2013-0242 Buffer overrun in regexp matcher has been fixed (Bugzilla
#15078).
diff --git a/sysdeps/ieee754/dbl-64/s_nearbyint.c b/sysdeps/ieee754/dbl-64/s_nearbyint.c
index eb40c29..5017f47 100644
--- a/sysdeps/ieee754/dbl-64/s_nearbyint.c
+++ b/sysdeps/ieee754/dbl-64/s_nearbyint.c
@@ -47,6 +47,7 @@ double __nearbyint(double x)
libc_feholdexcept (&env);
w = TWO52[sx]+x;
t = w-TWO52[sx];
+ math_force_eval (t);
libc_fesetenv (&env);
GET_HIGH_WORD(i0,t);
SET_HIGH_WORD(t,(i0&0x7fffffff)|(sx<<31));
@@ -59,6 +60,7 @@ double __nearbyint(double x)
libc_feholdexcept (&env);
w = TWO52[sx]+x;
t = w-TWO52[sx];
+ math_force_eval (t);
libc_fesetenv (&env);
return t;
}
diff --git a/sysdeps/ieee754/flt-32/s_nearbyintf.c b/sysdeps/ieee754/flt-32/s_nearbyintf.c
index 48debad..5aebefa 100644
--- a/sysdeps/ieee754/flt-32/s_nearbyintf.c
+++ b/sysdeps/ieee754/flt-32/s_nearbyintf.c
@@ -39,6 +39,7 @@ __nearbyintf(float x)
libc_feholdexceptf (&env);
w = TWO23[sx]+x;
t = w-TWO23[sx];
+ math_force_eval (t);
libc_fesetenvf (&env);
GET_FLOAT_WORD(i0,t);
SET_FLOAT_WORD(t,(i0&0x7fffffff)|(sx<<31));
@@ -51,6 +52,7 @@ __nearbyintf(float x)
libc_feholdexceptf (&env);
w = TWO23[sx]+x;
t = w-TWO23[sx];
+ math_force_eval (t);
libc_fesetenvf (&env);
return t;
}
diff --git a/sysdeps/ieee754/ldbl-128/s_nearbyintl.c b/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
index d2afc10..2017c04 100644
--- a/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
+++ b/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
@@ -47,6 +47,7 @@ long double __nearbyintl(long double x)
feholdexcept (&env);
w = TWO112[sx]+x;
t = w-TWO112[sx];
+ math_force_eval (t);
fesetenv (&env);
GET_LDOUBLE_MSW64(i0,t);
SET_LDOUBLE_MSW64(t,(i0&0x7fffffffffffffffLL)|(sx<<63));
@@ -59,6 +60,7 @@ long double __nearbyintl(long double x)
feholdexcept (&env);
w = TWO112[sx]+x;
t = w-TWO112[sx];
+ math_force_eval (t);
fesetenv (&env);
return t;
}
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c b/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
index b654bf5..bfcd110 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
@@ -21,6 +21,7 @@
when it's coded in C. */
#include <math.h>
+#include <math_private.h>
#include <fenv.h>
#include <math_ldbl_opt.h>
#include <float.h>
@@ -53,6 +54,8 @@ __nearbyintl (long double x)
}
u.dd[0] = high;
u.dd[1] = 0.0;
+ math_force_eval (u.dd[0]);
+ math_force_eval (u.dd[1]);
fesetenv (&env);
}
else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
@@ -109,6 +112,8 @@ __nearbyintl (long double x)
}
u.dd[0] = high + low;
u.dd[1] = high - u.dd[0] + low;
+ math_force_eval (u.dd[0]);
+ math_force_eval (u.dd[1]);
fesetenv (&env);
}
diff --git a/sysdeps/ieee754/ldbl-96/s_nearbyintl.c b/sysdeps/ieee754/ldbl-96/s_nearbyintl.c
index ed9836c..c1d77f0 100644
--- a/sysdeps/ieee754/ldbl-96/s_nearbyintl.c
+++ b/sysdeps/ieee754/ldbl-96/s_nearbyintl.c
@@ -54,6 +54,7 @@ long double __nearbyintl(long double x)
feholdexcept (&env);
w = TWO63[sx]+x;
t = w-TWO63[sx];
+ math_force_eval (t);
fesetenv (&env);
GET_LDOUBLE_EXP(i0,t);
SET_LDOUBLE_EXP(t,(i0&0x7fff)|(sx<<15));
@@ -80,6 +81,7 @@ long double __nearbyintl(long double x)
feholdexcept (&env);
w = TWO63[sx]+x;
t = w-TWO63[sx];
+ math_force_eval (t);
fesetenv (&env);
return t;
}