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.21-83-ga820f9b


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  a820f9b3c0cb5e80cd892b0f9c1c48f48bd4413f (commit)
      from  be802953a103bfd502d696f1418e2bef1b450be2 (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=a820f9b3c0cb5e80cd892b0f9c1c48f48bd4413f

commit a820f9b3c0cb5e80cd892b0f9c1c48f48bd4413f
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Mon Feb 16 22:38:28 2015 +0000

    Fix remquo spurious overflows (bug 17978).
    
    Various remquo implementations, when computing the last three bits of
    the quotient, have spurious overflows when 4 times the second argument
    to remquo overflows.  These overflows can in turn cause bad results in
    rounding modes where that overflow results in a finite value.  This
    patch adds tests to avoid the problem multiplications in cases where
    they would overflow, similar to those that control an earlier
    multiplication by 8.
    
    Tested for x86_64, x86, mips64 and powerpc.
    
    	[BZ #17978]
    	* sysdeps/ieee754/dbl-64/s_remquo.c (__remquo): Do not form
    	products 4 * y and 2 * y where those would overflow.
    	* sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c (__remquo):
    	Likewise.
    	* sysdeps/ieee754/flt-32/s_remquof.c (__remquof): Likewise.
    	* sysdeps/ieee754/ldbl-128/s_remquol.c (__remquol): Likewise.
    	* sysdeps/ieee754/ldbl-128ibm/s_remquol.c (__remquol): Likewise.
    	* sysdeps/ieee754/ldbl-96/s_remquol.c (__remquol): Likewise.
    	* math/libm-test.inc (remquo_test_data): Add more tests.

diff --git a/ChangeLog b/ChangeLog
index c09d9f8..cde2c5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2015-02-16  Joseph Myers  <joseph@codesourcery.com>
 
+	[BZ #17978]
+	* sysdeps/ieee754/dbl-64/s_remquo.c (__remquo): Do not form
+	products 4 * y and 2 * y where those would overflow.
+	* sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c (__remquo):
+	Likewise.
+	* sysdeps/ieee754/flt-32/s_remquof.c (__remquof): Likewise.
+	* sysdeps/ieee754/ldbl-128/s_remquol.c (__remquol): Likewise.
+	* sysdeps/ieee754/ldbl-128ibm/s_remquol.c (__remquol): Likewise.
+	* sysdeps/ieee754/ldbl-96/s_remquol.c (__remquol): Likewise.
+	* math/libm-test.inc (remquo_test_data): Add more tests.
+
 	* sysdeps/mips/sgidefs.h [!_ABIO64] (_ABIO64): New macro.
 
 	* sysdeps/mips/memcpy.S [_COMPILING_NEWLIB]: Change condition to
diff --git a/NEWS b/NEWS
index 781f7a7..4f4f740 100644
--- a/NEWS
+++ b/NEWS
@@ -10,7 +10,7 @@ Version 2.22
 * The following bugs are resolved with this release:
 
   4719, 15467, 15790, 16560, 17569, 17792, 17912, 17932, 17944, 17949,
-  17964, 17965, 17967, 17969.
+  17964, 17965, 17967, 17969, 17978.
 
 Version 2.21
 
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 2f3902a..1cf80e3 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -8764,6 +8764,60 @@ static const struct test_ffI_f1_data remquo_test_data[] =
     TEST_ffI_f1 (remquo, -3419, 360, -179, -1, NO_INEXACT_EXCEPTION),
     TEST_ffI_f1 (remquo, 3419, -360, 179, -1, NO_INEXACT_EXCEPTION),
     TEST_ffI_f1 (remquo, -3419, -360, -179, 1, NO_INEXACT_EXCEPTION),
+
+    TEST_ffI_f1 (remquo, max_value, max_value, plus_zero, 1, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, max_value, -max_value, plus_zero, -1, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, max_value, min_value, plus_zero, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, max_value, -min_value, plus_zero, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, max_value, min_subnorm_value, plus_zero, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, max_value, -min_subnorm_value, plus_zero, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -max_value, max_value, minus_zero, -1, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -max_value, -max_value, minus_zero, 1, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -max_value, min_value, minus_zero, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -max_value, -min_value, minus_zero, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -max_value, min_subnorm_value, minus_zero, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -max_value, -min_subnorm_value, minus_zero, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, min_value, max_value, min_value, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, min_value, -max_value, min_value, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, min_value, min_value, plus_zero, 1, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, min_value, -min_value, plus_zero, -1, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, min_value, min_subnorm_value, plus_zero, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, min_value, -min_subnorm_value, plus_zero, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -min_value, max_value, -min_value, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -min_value, -max_value, -min_value, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -min_value, min_value, minus_zero, -1, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -min_value, -min_value, minus_zero, 1, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -min_value, min_subnorm_value, minus_zero, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -min_value, -min_subnorm_value, minus_zero, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, min_subnorm_value, max_value, min_subnorm_value, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, min_subnorm_value, -max_value, min_subnorm_value, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, min_subnorm_value, min_value, min_subnorm_value, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, min_subnorm_value, -min_value, min_subnorm_value, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, min_subnorm_value, min_subnorm_value, plus_zero, 1, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, min_subnorm_value, -min_subnorm_value, plus_zero, -1, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -min_subnorm_value, max_value, -min_subnorm_value, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -min_subnorm_value, -max_value, -min_subnorm_value, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -min_subnorm_value, min_value, -min_subnorm_value, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -min_subnorm_value, -min_value, -min_subnorm_value, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -min_subnorm_value, min_subnorm_value, minus_zero, -1, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -min_subnorm_value, -min_subnorm_value, minus_zero, 1, NO_INEXACT_EXCEPTION),
+
+    TEST_ffI_f1 (remquo, 1, max_value, 1, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, 1, -max_value, 1, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, 1, max_value / 2, 1, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, 1, -max_value / 2, 1, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, 1, max_value / 4, 1, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, 1, -max_value / 4, 1, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, 1, max_value / 8, 1, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, 1, -max_value / 8, 1, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -1, max_value, -1, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -1, -max_value, -1, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -1, max_value / 2, -1, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -1, -max_value / 2, -1, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -1, max_value / 4, -1, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -1, -max_value / 4, -1, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -1, max_value / 8, -1, 0, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -1, -max_value / 8, -1, 0, NO_INEXACT_EXCEPTION),
   };
 
 static void
diff --git a/sysdeps/ieee754/dbl-64/s_remquo.c b/sysdeps/ieee754/dbl-64/s_remquo.c
index 2724902..e07efa8 100644
--- a/sysdeps/ieee754/dbl-64/s_remquo.c
+++ b/sysdeps/ieee754/dbl-64/s_remquo.c
@@ -60,12 +60,12 @@ __remquo (double x, double y, int *quo)
   y = fabs (y);
   cquo = 0;
 
-  if (x >= 4 * y)
+  if (hy <= 0x7fcfffff && x >= 4 * y)
     {
       x -= 4 * y;
       cquo += 4;
     }
-  if (x >= 2 * y)
+  if (hy <= 0x7fdfffff && x >= 2 * y)
     {
       x -= 2 * y;
       cquo += 2;
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c
index 5b71425..ab56178 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c
@@ -59,12 +59,12 @@ __remquo (double x, double y, int *quo)
   INSERT_WORDS64 (y, hy);
   cquo = 0;
 
-  if (x >= 4 * y)
+  if (hy <= UINT64_C(0x7fcfffffffffffff) && x >= 4 * y)
     {
       x -= 4 * y;
       cquo += 4;
     }
-  if (x >= 2 * y)
+  if (hy <= UINT64_C(0x7fdfffffffffffff) && x >= 2 * y)
     {
       x -= 2 * y;
       cquo += 2;
diff --git a/sysdeps/ieee754/flt-32/s_remquof.c b/sysdeps/ieee754/flt-32/s_remquof.c
index a9cdf8f..04944fd 100644
--- a/sysdeps/ieee754/flt-32/s_remquof.c
+++ b/sysdeps/ieee754/flt-32/s_remquof.c
@@ -59,12 +59,12 @@ __remquof (float x, float y, int *quo)
   y  = fabsf (y);
   cquo = 0;
 
-  if (x >= 4 * y)
+  if (hy <= 0x7e7fffff && x >= 4 * y)
     {
       x -= 4 * y;
       cquo += 4;
     }
-  if (x >= 2 * y)
+  if (hy <= 0x7effffff && x >= 2 * y)
     {
       x -= 2 * y;
       cquo += 2;
diff --git a/sysdeps/ieee754/ldbl-128/s_remquol.c b/sysdeps/ieee754/ldbl-128/s_remquol.c
index 8543265..da175a1 100644
--- a/sysdeps/ieee754/ldbl-128/s_remquol.c
+++ b/sysdeps/ieee754/ldbl-128/s_remquol.c
@@ -61,12 +61,12 @@ __remquol (long double x, long double y, int *quo)
   y  = fabsl (y);
   cquo = 0;
 
-  if (x >= 4 * y)
+  if (hy <= 0x7ffcffffffffffffLL && x >= 4 * y)
     {
       x -= 4 * y;
       cquo += 4;
     }
-  if (x >= 2 * y)
+  if (hy <= 0x7ffdffffffffffffLL && x >= 2 * y)
     {
       x -= 2 * y;
       cquo += 2;
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_remquol.c b/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
index e36af52..ac22879 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
@@ -66,12 +66,12 @@ __remquol (long double x, long double y, int *quo)
   y  = fabsl (y);
   cquo = 0;
 
-  if (x >= 4 * y)
+  if (hy <= 0x7fcfffffffffffffLL && x >= 4 * y)
     {
       x -= 4 * y;
       cquo += 4;
     }
-  if (x >= 2 * y)
+  if (hy <= 0x7fdfffffffffffffLL && x >= 2 * y)
     {
       x -= 2 * y;
       cquo += 2;
diff --git a/sysdeps/ieee754/ldbl-96/s_remquol.c b/sysdeps/ieee754/ldbl-96/s_remquol.c
index 6b3499d..1462b54 100644
--- a/sysdeps/ieee754/ldbl-96/s_remquol.c
+++ b/sysdeps/ieee754/ldbl-96/s_remquol.c
@@ -60,12 +60,12 @@ __remquol (long double x, long double p, int *quo)
   p  = fabsl (p);
   cquo = 0;
 
-  if (x >= 4 * p)
+  if (ep <= 0x7ffc && x >= 4 * p)
     {
       x -= 4 * p;
       cquo += 4;
     }
-  if (x >= 2 * p)
+  if (ep <= 0x7ffd && x >= 2 * p)
     {
       x -= 2 * p;
       cquo += 2;

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

Summary of changes:
 ChangeLog                                     |   11 +++++
 NEWS                                          |    2 +-
 math/libm-test.inc                            |   54 +++++++++++++++++++++++++
 sysdeps/ieee754/dbl-64/s_remquo.c             |    4 +-
 sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c |    4 +-
 sysdeps/ieee754/flt-32/s_remquof.c            |    4 +-
 sysdeps/ieee754/ldbl-128/s_remquol.c          |    4 +-
 sysdeps/ieee754/ldbl-128ibm/s_remquol.c       |    4 +-
 sysdeps/ieee754/ldbl-96/s_remquol.c           |    4 +-
 9 files changed, 78 insertions(+), 13 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]