]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Avoid spurious failures from <fenv.h> fallback functions (bug 15654).
authorJoseph Myers <joseph@codesourcery.com>
Thu, 20 Jun 2013 19:10:44 +0000 (19:10 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 20 Jun 2013 19:10:44 +0000 (19:10 +0000)
12 files changed:
ChangeLog
NEWS
math/fedisblxcpt.c
math/feenablxcpt.c
math/fegetenv.c
math/fegetexcept.c
math/fegetround.c
math/feholdexcpt.c
math/fesetenv.c
math/fesetround.c
math/feupdateenv.c
math/fgetexcptflg.c

index 5fa4885c5d7656da00de963b793be1fdfa65290e..67ccca5d061c9ca0e39cad9693eeda8b2c3c5568 100644 (file)
--- 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 be21e29e586597c5774819b5437d15a9e37b6176..f8aa62269218d3d0ef1a1e00e711ed4a9f1795e4 100644 (file)
--- 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).
index 9b6ef278886bf73be1e9d41c99aefc942c1e050a..9b8374adeb25070fc52d334c2ca87d467807aa80 100644 (file)
@@ -22,7 +22,7 @@
 int
 fedisableexcept (int excepts)
 {
-  /* Signal failure.  */
-  return -1;
+  /* All exception traps are disabled.  */
+  return 0;
 }
 stub_warning (fedisableexcept)
index d8620a03f0b10df186d5b6c21c9cdfd958a96883..e57d4e3c15275be6b0b56cac5ef1d7630713770d 100644 (file)
 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)
index 14bb8012370551b6272ed6b8ef130634098e7b6f..29229dc22abcfb5be5503b400902e3829d953853 100644 (file)
@@ -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)
index 42aaf935e53a43c13cf3ac9ee62793926e4d5745..9075160ee00f4b0e80261518bc00191eb0ac9178 100644 (file)
@@ -22,7 +22,7 @@
 int
 fegetexcept (void)
 {
-  /* Signal failure.  */
-  return -1;
+  /* All exception traps are disabled.  */
+  return 0;
 }
 stub_warning (fegetexcept)
index deb3c5d02bfe05341171754e6a2ed6d5b4611449..24bbd1609781601bb19fb3abe2939f0b02933e2d 100644 (file)
 int
 fegetround (void)
 {
+#ifdef FE_TONEAREST
+  return FE_TONEAREST;
+#else
   return 0;
+#endif
 }
 stub_warning (fegetround)
index b4e32609626e99caae873876d9fdcbad174a585b..c830afbe6eaabf5e9f318bbf04c82740a8944d25 100644 (file)
@@ -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)
index 058700f19cb15175f122e44bb42051dea568b18d..736195818d618dd71f090b55aee7ac5d4ffc4992 100644 (file)
@@ -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)
index 0e06217140970b78747e7e95b2a04024b1154408..1895a20f184d8a5f0b5f50a75c3238d1389c138c 100644 (file)
 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)
index e0350b32840868601668e70538ce6a269124aea8..5a39521eedd5ccd9e080971cd08f21750c582a6b 100644 (file)
@@ -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)
index 151286454d621f69378e27246734d1a22a322fb4..764be42e6bde2d553501abe6f1a6bd6f1bbab3ba 100644 (file)
@@ -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)