This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.24-49-g98dac0c


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  98dac0ce7641cb081f696cc80a22be7af6d62caa (commit)
      from  ab70f211651f50622d7f8afe3f6a68c472b1fb5a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=98dac0ce7641cb081f696cc80a22be7af6d62caa

commit 98dac0ce7641cb081f696cc80a22be7af6d62caa
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Fri Aug 12 17:34:01 2016 +0000

    Fix test-fexcept when "inexact" implicitly raised.
    
    ISO C allows feraiseexcept to raise "inexact", in addition to the
    requested exceptions, when requested to raise "overflow" or
    "underflow".  Testing on ARM and PowerPC e500 (where glibc's
    feraiseexcept has this property) showed that the new test-fexcept test
    failed to allow for this; this patch fixes it, by wrapping
    feraiseexcept to clear FE_INEXACT if implicitly raised and not raised
    before the call.  (It would also be possible to do this with
    fesetexcept, which always affects exactly the requested flags, but
    this patch avoids making this fix depend on the fesetexcept changes.)
    
    Tested for x86_64, x86, arm and e500.
    
    	* math/test-fexcept.c (feraiseexcept_exact): New function.
    	(test_set): Call feraiseexcept_exact instead of feraiseexcept.
    	(test_except): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 15bd364..58f4e1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-08-12  Joseph Myers  <joseph@codesourcery.com>
+
+	* math/test-fexcept.c (feraiseexcept_exact): New function.
+	(test_set): Call feraiseexcept_exact instead of feraiseexcept.
+	(test_except): Likewise.
+
 2016-08-10  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #20455]
diff --git a/math/test-fexcept.c b/math/test-fexcept.c
index 5e181a1..36d14c5 100644
--- a/math/test-fexcept.c
+++ b/math/test-fexcept.c
@@ -20,6 +20,35 @@
 #include <stdio.h>
 #include <math-tests.h>
 
+/* Like feraiseexcept, but raise exactly the specified exceptions EXC,
+   without possibly raising "inexact" together with "overflow" or
+   "underflow" as permitted by ISO C.  (This is not used with traps
+   enabled, so side-effects from raising and then clearing "inexact"
+   are irrelevant.)  */
+
+static int
+feraiseexcept_exact (int exc)
+{
+#ifdef FE_INEXACT
+  int mask = 0;
+#ifdef FE_OVERFLOW
+  mask |= FE_OVERFLOW;
+#endif
+#ifdef FE_UNDERFLOW
+  mask |= FE_UNDERFLOW;
+#endif
+  if ((exc & FE_INEXACT) != 0
+      || (exc & mask) == 0
+      || fetestexcept (FE_INEXACT) != 0)
+    return feraiseexcept (exc);
+  int ret = feraiseexcept (exc);
+  feclearexcept (FE_INEXACT);
+  return ret;
+#else
+  return feraiseexcept (exc);
+#endif
+}
+
 static int
 test_set (int initial, const fexcept_t *saved, int mask, int expected)
 {
@@ -28,7 +57,7 @@ test_set (int initial, const fexcept_t *saved, int mask, int expected)
   printf ("Testing set: initial exceptions %x, mask %x, expected %x\n",
 	  (unsigned int) initial, (unsigned int) mask,
 	  (unsigned int) expected);
-  int ret = feraiseexcept (initial);
+  int ret = feraiseexcept_exact (initial);
   if (ret != 0)
     {
       puts ("feraiseexcept failed");
@@ -81,7 +110,7 @@ test_except (int exc, const char *exc_name)
       return result;
     }
 
-  ret = feraiseexcept (exc);
+  ret = feraiseexcept_exact (exc);
   if (ret == 0)
     printf ("feraiseexcept (%s) succeeded\n", exc_name);
   else

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |    6 ++++++
 math/test-fexcept.c |   33 +++++++++++++++++++++++++++++++--
 2 files changed, 37 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]