[Gmp-commit] /var/hg/gmp-5.1: 5 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Wed Mar 13 12:37:36 CET 2013


details:   /var/hg/gmp-5.1/rev/ec4d88674036
changeset: 15397:ec4d88674036
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Wed Mar 13 12:31:24 2013 +0100
description:
(mod): Adhere to mpn_mu_div_qr's overlap requirements.

details:   /var/hg/gmp-5.1/rev/0d9c9d28a947
changeset: 15398:0d9c9d28a947
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Wed Mar 13 12:31:44 2013 +0100
description:
Test larger arguments.

details:   /var/hg/gmp-5.1/rev/18537ee6d95b
changeset: 15399:18537ee6d95b
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Wed Mar 13 12:31:53 2013 +0100
description:
ChangeLog

details:   /var/hg/gmp-5.1/rev/cd77f2b507a8
changeset: 15400:cd77f2b507a8
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Wed Mar 13 12:33:02 2013 +0100
description:
Make files executable.

details:   /var/hg/gmp-5.1/rev/11165fc1b5e8
changeset: 15401:11165fc1b5e8
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Wed Mar 13 12:37:33 2013 +0100
description:
Trivial merge.

diffstat:

 ChangeLog                   |  23 +++++++++++++++++++++++
 mini-gmp/mini-gmp.c         |   9 ++++-----
 mini-gmp/tests/t-add.c      |   2 +-
 mini-gmp/tests/t-bitops.c   |   2 +-
 mini-gmp/tests/t-div.c      |   2 +-
 mini-gmp/tests/t-div_2exp.c |   2 +-
 mini-gmp/tests/t-double.c   |  11 +++++------
 mini-gmp/tests/t-gcd.c      |   2 +-
 mini-gmp/tests/t-import.c   |   2 +-
 mini-gmp/tests/t-invert.c   |   2 +-
 mini-gmp/tests/t-lcm.c      |   2 +-
 mini-gmp/tests/t-logops.c   |   2 +-
 mini-gmp/tests/t-mul.c      |   2 +-
 mini-gmp/tests/t-powm.c     |   2 +-
 mini-gmp/tests/t-reuse.c    |   4 ++--
 mini-gmp/tests/t-root.c     |   2 +-
 mini-gmp/tests/t-scan.c     |   2 +-
 mini-gmp/tests/t-sqrt.c     |   2 +-
 mini-gmp/tests/t-str.c      |   7 ++-----
 mini-gmp/tests/testutils.c  |  10 ++++++++++
 mini-gmp/tests/testutils.h  |   2 ++
 mpz/powm_ui.c               |  11 ++++++++---
 tests/mpz/t-powm_ui.c       |  16 +++-------------
 23 files changed, 73 insertions(+), 48 deletions(-)

diffs (truncated from 435 to 300 lines):

diff -r e616ff715c34 -r 11165fc1b5e8 ChangeLog
--- a/ChangeLog	Sun Feb 17 19:40:16 2013 +0100
+++ b/ChangeLog	Wed Mar 13 12:37:33 2013 +0100
@@ -1,3 +1,26 @@
+2013-03-11  Torbjorn Granlund  <tege at gmplib.org>
+
+	* tests/mpz/t-powm_ui.c: Test larger arguments.
+
+	* mpz/powm_ui.c (mod): Adhere to mpn_mu_div_qr's overlap requirements.
+
+2013-02-25  Niels Möller  <nisse at lysator.liu.se>
+
+	* mini-gmp/tests/t-double.c (testmain): Declare double variables
+	as volatile, to drop extended precision.
+
+	* mini-gmp/tests/testutils.c (testfree): New function. Use it
+	everywhere where test programs deallocate storage allocated via
+	the mini-gmp allocation functions, including uses of mpz_get_str
+	for various test failure messages.
+
+2013-02-19 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mini-gmp/mini-gmp.c: Move asserts to work-around a compiler bug.
+
+	* mini-gmp/tests/t-reuse.c: Fix typo causing the same negation condition
+	to be applied to all operands. (See 2013-02-03, Torbjorn)
+
 2013-02-16  Marc Glisse  <marc.glisse at inria.fr>
 
 	* gmpxx.h: Include <algorithm>.
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/mini-gmp.c	Wed Mar 13 12:37:33 2013 +0100
@@ -930,11 +930,11 @@
 
   assert (dn > 2);
   assert (nn >= dn);
-  assert ((dp[dn-1] & GMP_LIMB_HIGHBIT) != 0);
 
   d1 = dp[dn - 1];
   d0 = dp[dn - 2];
 
+  assert ((d1 & GMP_LIMB_HIGHBIT) != 0);
   /* Iteration variable is the index of the q limb.
    *
    * We divide <n1, np[dn-1+i], np[dn-2+i], np[dn-3+i],..., np[i]>
@@ -994,7 +994,9 @@
       mp_limb_t nh;
       unsigned shift;
 
-      assert (dp[dn-1] & GMP_LIMB_HIGHBIT);
+      assert (inv->d1 == dp[dn-1]);
+      assert (inv->d0 == dp[dn-2]);
+      assert ((inv->d1 & GMP_LIMB_HIGHBIT) != 0);
 
       shift = inv->shift;
       if (shift > 0)
@@ -1002,9 +1004,6 @@
       else
 	nh = 0;
 
-      assert (inv->d1 == dp[dn-1]);
-      assert (inv->d0 == dp[dn-2]);
-
       mpn_div_qr_pi1 (qp, np, nn, nh, dp, dn, inv->di);
 
       if (shift > 0)
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-add.c
--- a/mini-gmp/tests/t-add.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-add.c	Wed Mar 13 12:37:33 2013 +0100
@@ -30,7 +30,7 @@
 {
   char *buf = mpz_get_str (NULL, 16, x);
   fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);
+  testfree (buf);
 }
 
 void
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-bitops.c
--- a/mini-gmp/tests/t-bitops.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-bitops.c	Wed Mar 13 12:37:33 2013 +0100
@@ -31,7 +31,7 @@
 {
   char *buf = mpz_get_str (NULL, 16, x);
   fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);
+  testfree (buf);
 }
 
 void
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-div.c
--- a/mini-gmp/tests/t-div.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-div.c	Wed Mar 13 12:37:33 2013 +0100
@@ -31,7 +31,7 @@
 {
   char *buf = mpz_get_str (NULL, 16, x);
   fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);
+  testfree (buf);
 }
 
 typedef void div_qr_func (mpz_t, mpz_t, const mpz_t, const mpz_t);
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-div_2exp.c
--- a/mini-gmp/tests/t-div_2exp.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-div_2exp.c	Wed Mar 13 12:37:33 2013 +0100
@@ -31,7 +31,7 @@
 {
   char *buf = mpz_get_str (NULL, 16, x);
   fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);
+  testfree (buf);
 }
 
 typedef void div_func (mpz_t, const mpz_t, mp_bitcnt_t);
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-double.c
--- a/mini-gmp/tests/t-double.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-double.c	Wed Mar 13 12:37:33 2013 +0100
@@ -34,7 +34,7 @@
 {
   char *buf = mpz_get_str (NULL, 16, x);
   fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);
+  testfree (buf);
 }
 
 static const struct
@@ -61,9 +61,6 @@
   unsigned i;
   mpz_t x;
 
-  void (*freefunc) (void *, size_t);
-  mp_get_memory_functions (NULL, NULL, &freefunc);
-
   for (i = 0; values[i].s; i++)
     {
       char *s;
@@ -78,7 +75,7 @@
 		   values[i].d, s, values[i].s);
 	  abort ();
 	}
-      freefunc(s, 0);
+      testfree (s);
       mpz_clear (x);
     }
 
@@ -86,7 +83,9 @@
 
   for (i = 0; i < COUNT; i++)
     {
-      double d, f;
+      /* Use volatile, to avoid extended precision in floating point
+	 registers, e.g., on m68k and 80387. */
+      volatile double d, f;
       unsigned long m;
       int e;
 
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-gcd.c
--- a/mini-gmp/tests/t-gcd.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-gcd.c	Wed Mar 13 12:37:33 2013 +0100
@@ -31,7 +31,7 @@
 {
   char *buf = mpz_get_str (NULL, 16, x);
   fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);
+  testfree (buf);
 }
 
 /* Called when g is supposed to be gcd(a,b), and g = s a + t b. */
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-import.c
--- a/mini-gmp/tests/t-import.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-import.c	Wed Mar 13 12:37:33 2013 +0100
@@ -31,7 +31,7 @@
 {
   char *buf = mpz_get_str (NULL, 16, x);
   fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);
+  testfree (buf);
 }
 
 static void
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-invert.c
--- a/mini-gmp/tests/t-invert.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-invert.c	Wed Mar 13 12:37:33 2013 +0100
@@ -32,7 +32,7 @@
 {
   char *buf = mpz_get_str (NULL, 16, x);
   fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);
+  testfree (buf);
 }
 
 void
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-lcm.c
--- a/mini-gmp/tests/t-lcm.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-lcm.c	Wed Mar 13 12:37:33 2013 +0100
@@ -31,7 +31,7 @@
 {
   char *buf = mpz_get_str (NULL, 16, x);
   fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);
+  testfree (buf);
 }
 
 void
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-logops.c
--- a/mini-gmp/tests/t-logops.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-logops.c	Wed Mar 13 12:37:33 2013 +0100
@@ -31,7 +31,7 @@
 {
   char *buf = mpz_get_str (NULL, 16, x);
   fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);
+  testfree (buf);
 }
 
 void
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-mul.c
--- a/mini-gmp/tests/t-mul.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-mul.c	Wed Mar 13 12:37:33 2013 +0100
@@ -35,7 +35,7 @@
 {
   char *buf = mpz_get_str (NULL, 16, x);
   fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);
+  testfree (buf);
 }
 
 void
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-powm.c
--- a/mini-gmp/tests/t-powm.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-powm.c	Wed Mar 13 12:37:33 2013 +0100
@@ -31,7 +31,7 @@
 {
   char *buf = mpz_get_str (NULL, 16, x);
   fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);
+  testfree (buf);
 }
 
 void
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-reuse.c
--- a/mini-gmp/tests/t-reuse.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-reuse.c	Wed Mar 13 12:37:33 2013 +0100
@@ -192,9 +192,9 @@
       bsi = mpz_get_ui (bs);
       if ((bsi & 1) != 0)
 	mpz_neg (in1, in1);
-      if ((bsi & 1) != 0)
+      if ((bsi & 2) != 0)
 	mpz_neg (in2, in2);
-      if ((bsi & 1) != 0)
+      if ((bsi & 4) != 0)
 	mpz_neg (in3, in3);
 
       for (i = 0; i < sizeof (dss_funcs) / sizeof (dss_func); i++)
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-root.c
--- a/mini-gmp/tests/t-root.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-root.c	Wed Mar 13 12:37:33 2013 +0100
@@ -31,7 +31,7 @@
 {
   char *buf = mpz_get_str (NULL, 16, x);
   fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);
+  testfree (buf);
 }
 
 /* Called when s is supposed to be floor(root(u,z)), and r = u - s^z */
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-scan.c
--- a/mini-gmp/tests/t-scan.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-scan.c	Wed Mar 13 12:37:33 2013 +0100
@@ -31,7 +31,7 @@
 {
   char *buf = mpz_get_str (NULL, 16, x);
   fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);
+  testfree (buf);
 }
 
 void
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-sqrt.c
--- a/mini-gmp/tests/t-sqrt.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-sqrt.c	Wed Mar 13 12:37:33 2013 +0100
@@ -31,7 +31,7 @@
 {
   char *buf = mpz_get_str (NULL, 16, x);
   fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);
+  testfree (buf);
 }
 
 /* Called when s is supposed to be floor(sqrt(u)), and r = u - s^2 */
diff -r e616ff715c34 -r 11165fc1b5e8 mini-gmp/tests/t-str.c
--- a/mini-gmp/tests/t-str.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/tests/t-str.c	Wed Mar 13 12:37:33 2013 +0100
@@ -36,7 +36,7 @@
 {
   char *buf = mpz_get_str (NULL, 16, x);
   fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);


More information about the gmp-commit mailing list