summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-06-20 19:10:44 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-06-20 19:10:44 +0000
commitc91e0825251b4f57e8ce1d9d4673bee6e279e0cd (patch)
tree8ec4d95dc25e260084f23726cbb2cc202ed46e93
parentbfcacbdec0ea80b12b23f89572c29b87624e76ec (diff)
downloadglibc-c91e0825251b4f57e8ce1d9d4673bee6e279e0cd.tar.gz
glibc-c91e0825251b4f57e8ce1d9d4673bee6e279e0cd.tar.xz
glibc-c91e0825251b4f57e8ce1d9d4673bee6e279e0cd.zip
Avoid spurious failures from <fenv.h> fallback functions (bug 15654).
-rw-r--r--ChangeLog16
-rw-r--r--NEWS2
-rw-r--r--math/fedisblxcpt.c4
-rw-r--r--math/feenablxcpt.c7
-rw-r--r--math/fegetenv.c4
-rw-r--r--math/fegetexcept.c4
-rw-r--r--math/fegetround.c4
-rw-r--r--math/feholdexcpt.c3
-rw-r--r--math/fesetenv.c4
-rw-r--r--math/fesetround.c4
-rw-r--r--math/feupdateenv.c4
-rw-r--r--math/fgetexcptflg.c4
12 files changed, 44 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 5fa4885c5d..67ccca5d06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2013-06-20  Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #15654]
+	* math/fedisblxcpt.c (fedisableexcept): Return 0.
+	* math/feenablxcpt.c (feenableexcept): Return 0 for argument 0.
+	* math/fegetenv.c (__fegetenv): Return 0.
+	* math/fegetexcept.c (fegetexcept): Return 0.
+	* math/fegetround.c (fegetround) [FE_TONEAREST]: Return
+	FE_TONEAREST.
+	* math/feholdexcpt.c (feholdexcept): Return 0.
+	* math/fesetenv.c (__fesetenv): Return 0.
+	* math/fesetround.c (fesetround) [FE_TONEAREST]: Return 0 for
+	argument FE_TONEAREST.
+	* math/feupdateenv.c (__feupdateenv): Return 0.
+	* math/fgetexcptflg.c (__fegetexceptflag): Return 0.
+
 2013-06-18  Roland McGrath  <roland@hack.frob.com>
 
 	* elf/rtld-Rules (rtld-compile-command.S): New variable.
diff --git a/NEWS b/NEWS
index be21e29e58..f8aa622692 100644
--- a/NEWS
+++ b/NEWS
@@ -20,7 +20,7 @@ Version 2.18
   15361, 15366, 15380, 15381, 15394, 15395, 15405, 15406, 15409, 15416,
   15418, 15419, 15423, 15424, 15426, 15429, 15431, 15432, 15441, 15442,
   15448, 15465, 15480, 15485, 15488, 15490, 15492, 15493, 15497, 15506,
-  15529, 15536, 15553, 15577, 15583, 15618, 15627, 15631.
+  15529, 15536, 15553, 15577, 15583, 15618, 15627, 15631, 15654.
 
 * CVE-2013-0242 Buffer overrun in regexp matcher has been fixed (Bugzilla
   #15078).
diff --git a/math/fedisblxcpt.c b/math/fedisblxcpt.c
index 9b6ef27888..9b8374adeb 100644
--- a/math/fedisblxcpt.c
+++ b/math/fedisblxcpt.c
@@ -22,7 +22,7 @@
 int
 fedisableexcept (int excepts)
 {
-  /* Signal failure.  */
-  return -1;
+  /* All exception traps are disabled.  */
+  return 0;
 }
 stub_warning (fedisableexcept)
diff --git a/math/feenablxcpt.c b/math/feenablxcpt.c
index d8620a03f0..e57d4e3c15 100644
--- a/math/feenablxcpt.c
+++ b/math/feenablxcpt.c
@@ -22,7 +22,10 @@
 int
 feenableexcept (int excepts)
 {
-  /* Signal failure.  */
-  return -1;
+  /* Signal failure if any exception traps are to be enabled.  */
+  if (excepts != 0)
+    return -1;
+  else
+    return 0;
 }
 stub_warning (feenableexcept)
diff --git a/math/fegetenv.c b/math/fegetenv.c
index 14bb801237..29229dc22a 100644
--- a/math/fegetenv.c
+++ b/math/fegetenv.c
@@ -23,8 +23,8 @@
 int
 __fegetenv (fenv_t *envp)
 {
-  /* This always fails.  */
-  return 1;
+  /* Nothing to do.  */
+  return 0;
 }
 #if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
 strong_alias (__fegetenv, __old_fegetenv)
diff --git a/math/fegetexcept.c b/math/fegetexcept.c
index 42aaf935e5..9075160ee0 100644
--- a/math/fegetexcept.c
+++ b/math/fegetexcept.c
@@ -22,7 +22,7 @@
 int
 fegetexcept (void)
 {
-  /* Signal failure.  */
-  return -1;
+  /* All exception traps are disabled.  */
+  return 0;
 }
 stub_warning (fegetexcept)
diff --git a/math/fegetround.c b/math/fegetround.c
index deb3c5d02b..24bbd16097 100644
--- a/math/fegetround.c
+++ b/math/fegetround.c
@@ -22,6 +22,10 @@
 int
 fegetround (void)
 {
+#ifdef FE_TONEAREST
+  return FE_TONEAREST;
+#else
   return 0;
+#endif
 }
 stub_warning (fegetround)
diff --git a/math/feholdexcpt.c b/math/feholdexcpt.c
index b4e3260962..c830afbe6e 100644
--- a/math/feholdexcpt.c
+++ b/math/feholdexcpt.c
@@ -22,7 +22,8 @@
 int
 feholdexcept (fenv_t *envp)
 {
-  return 1;		/* Signal failure.  */
+  /* No exception traps to disable and no state to save.  */
+  return 0;
 }
 libm_hidden_def (feholdexcept)
 stub_warning (feholdexcept)
diff --git a/math/fesetenv.c b/math/fesetenv.c
index 058700f19c..736195818d 100644
--- a/math/fesetenv.c
+++ b/math/fesetenv.c
@@ -23,8 +23,8 @@
 int
 __fesetenv (const fenv_t *envp)
 {
-  /* This always fails.  */
-  return 1;
+  /* Nothing to do.  */
+  return 0;
 }
 #if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
 strong_alias (__fesetenv, __old_fesetenv)
diff --git a/math/fesetround.c b/math/fesetround.c
index 0e06217140..1895a20f18 100644
--- a/math/fesetround.c
+++ b/math/fesetround.c
@@ -22,7 +22,11 @@
 int
 fesetround (int round)
 {
+#ifdef FE_TONEAREST
+  return (round == FE_TONEAREST) ? 0 : 1;
+#else
   return 1;	/* Signal we are unable to set the direction.  */
+#endif
 }
 libm_hidden_def (fesetround)
 stub_warning (fesetround)
diff --git a/math/feupdateenv.c b/math/feupdateenv.c
index e0350b3284..5a39521eed 100644
--- a/math/feupdateenv.c
+++ b/math/feupdateenv.c
@@ -23,8 +23,8 @@
 int
 __feupdateenv (const fenv_t *envp)
 {
-  /* This always fails.  */
-  return 1;
+  /* Nothing to do.  */
+  return 0;
 }
 #if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
 strong_alias (__feupdateenv, __old_feupdateenv)
diff --git a/math/fgetexcptflg.c b/math/fgetexcptflg.c
index 151286454d..764be42e6b 100644
--- a/math/fgetexcptflg.c
+++ b/math/fgetexcptflg.c
@@ -23,8 +23,8 @@
 int
 __fegetexceptflag (fexcept_t *flagp, int excepts)
 {
-  /* This always fails.  */
-  return 1;
+  /* Nothing to do.  */
+  return 0;
 }
 #if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
 strong_alias (__fegetexceptflag, __old_fegetexceptflag)