]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Make fallback fesetexceptflag always succeed (bug 21028).
authorJoseph Myers <joseph@codesourcery.com>
Thu, 5 Jan 2017 23:15:47 +0000 (23:15 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 5 Jan 2017 23:15:47 +0000 (23:15 +0000)
The fallback implementation of fesetexceptflag currently fails if any
exceptions are specified.  It should always succeed, because the
exception state is always that all exceptions (if any are defined in
<fenv.h> but not supported in this configuration) are always clear,
just as fallback fetestexcept always succeeds and fallback fesetenv
always succeeds unless asked to set FE_NOMASK_ENV.

This patch fixes it accordingly.  Together with the patch to
test-fexcept.c to allow feraiseexcept to fail in another place, this
stops that test from failing for MIPS soft-float.

Tested for mips64 soft-float.

[BZ #21028]
* math/fsetexcptflg.c (__fesetexceptflag): Always return 0.
* math/test-fexcept.c (test_set): Allow failure of feraiseexcept
if EXCEPTION_TESTS returns false.

ChangeLog
math/fsetexcptflg.c
math/test-fexcept.c

index c67476fca5ffdf9a7577f4309cc50633065ff430..172b0c9275403467d0e1d74024321b3ee13c68cf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-01-05  Joseph Myers  <joseph@codesourcery.com>
+
+       [BZ #21028]
+       * math/fsetexcptflg.c (__fesetexceptflag): Always return 0.
+       * math/test-fexcept.c (test_set): Allow failure of feraiseexcept
+       if EXCEPTION_TESTS returns false.
+
 2017-01-05  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
        [BZ #20558]
index 2e8237ee32ca8b2df4cc40537a5599b4ad90ef94..e79095b04e554de56a836216c32a1fe9bb3cfcee 100644 (file)
@@ -23,8 +23,9 @@
 int
 __fesetexceptflag (const fexcept_t *flagp, int excepts)
 {
-  /* This always fails unless nothing needs to be done.  */
-  return (excepts != 0);
+  /* This always succeeds, as all exceptions are always clear
+     (including in the saved state) so nothing needs to be done.  */
+  return 0;
 }
 #if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
 strong_alias (__fesetexceptflag, __old_fesetexceptflag)
index 6aa54b49b4580de646a272168510e4706442147a..854080173a3899c1fe7b4466bc3f861175032ec4 100644 (file)
@@ -61,7 +61,13 @@ test_set (int initial, const fexcept_t *saved, int mask, int expected)
   if (ret != 0)
     {
       puts ("feraiseexcept failed");
-      result = 1;
+      if (initial == 0 || EXCEPTION_TESTS (float))
+       {
+         puts ("failure of feraiseexcept was unexpected");
+         result = 1;
+       }
+      else
+       puts ("failure of feraiseexcept OK, skipping further tests");
       return result;
     }
   ret = fesetexceptflag (saved, mask);