[Gmp-commit] /var/hg/gmp: 3 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Thu Feb 28 12:00:53 CET 2013
details: /var/hg/gmp/rev/7ea68a329cf2
changeset: 15501:7ea68a329cf2
user: Torbjorn Granlund <tege at gmplib.org>
date: Thu Feb 28 11:49:54 2013 +0100
description:
Whitespace cleanup.
details: /var/hg/gmp/rev/5cc6b2feb2f3
changeset: 15502:5cc6b2feb2f3
user: Torbjorn Granlund <tege at gmplib.org>
date: Thu Feb 28 11:51:54 2013 +0100
description:
Remove unused variables and functions.
details: /var/hg/gmp/rev/f661d334106c
changeset: 15503:f661d334106c
user: Torbjorn Granlund <tege at gmplib.org>
date: Thu Feb 28 12:00:45 2013 +0100
description:
Rewrite Valgrind paragraphs.
diffstat:
doc/gmp.texi | 12 +++++++-----
gmp-h.in | 6 +++---
mpn/generic/broot.c | 2 +-
mpz/ior.c | 1 -
tests/mpn/t-brootinv.c | 1 -
tests/mpn/t-hgcd_appr.c | 13 -------------
tests/mpq/t-get_d.c | 1 -
tests/mpz/t-bin.c | 4 +---
tests/mpz/t-jac.c | 2 --
tests/mpz/t-limbs.c | 4 ++--
tests/mpz/t-mfac_uiui.c | 4 ++--
11 files changed, 16 insertions(+), 34 deletions(-)
diffs (203 lines):
diff -r d4a2e4e0b904 -r f661d334106c doc/gmp.texi
--- a/doc/gmp.texi Wed Feb 27 19:47:36 2013 +0100
+++ b/doc/gmp.texi Thu Feb 28 12:00:45 2013 +0100
@@ -2647,19 +2647,21 @@
@item Valgrind
@cindex Valgrind
-The valgrind program (@uref{http://valgrind.org/}) is a memory
-checker for x86s. It translates and emulates machine instructions to do
+Valgrind (@uref{http://valgrind.org/}) is a memory checker for x86, ARM, MIPS,
+PowerPC, and S/390. It translates and emulates machine instructions to do
strong checks for uninitialized data (at the level of individual bits), memory
accesses through bad pointers, and memory leaks.
-Recent versions of Valgrind are getting support for MMX and SSE/SSE2
-instructions, for past versions GMP will need to be configured not to use
-those, i.e.@: for an x86 without them (for instance plain @samp{i486}).
+Valgrind does not always support every possible instruction, in particular
+ones recently added to an ISA. Valgrind might make therefore be incompatible
+with a recent GMP or even a less recent GMP which is compiled using a recent
+GCC.
GMP's assembly code sometimes promotes a read of the limbs to some larger size,
for efficiency. GMP will do this even at the start and end of a multilimb
operand, using naturaly aligned operations on the larger type. This may lead
to benign reads outside of allocated areas, triggering complants from Valgrind.
+Valgrind's option @samp{--partial-loads-ok=yes} should help.
@item Other Problems
Any suspected bug in GMP itself should be isolated to make sure it's not an
diff -r d4a2e4e0b904 -r f661d334106c gmp-h.in
--- a/gmp-h.in Wed Feb 27 19:47:36 2013 +0100
+++ b/gmp-h.in Thu Feb 28 12:00:45 2013 +0100
@@ -484,8 +484,8 @@
#define mp_get_memory_functions __gmp_get_memory_functions
__GMP_DECLSPEC void mp_get_memory_functions (void *(**) (size_t),
- void *(**) (void *, size_t, size_t),
- void (**) (void *, size_t)) __GMP_NOTHROW;
+ void *(**) (void *, size_t, size_t),
+ void (**) (void *, size_t)) __GMP_NOTHROW;
#define mp_bits_per_limb __gmp_bits_per_limb
__GMP_DECLSPEC extern const int mp_bits_per_limb;
@@ -1129,7 +1129,7 @@
#define mpz_limbs_finish __gmpz_limbs_finish
__GMP_DECLSPEC void mpz_limbs_finish (mpz_ptr, mp_size_t);
-#define mpz_roinit_n __gmpz_roinit_n
+#define mpz_roinit_n __gmpz_roinit_n
__GMP_DECLSPEC mpz_srcptr mpz_roinit_n (mpz_ptr, mp_srcptr, mp_size_t);
#define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }}
diff -r d4a2e4e0b904 -r f661d334106c mpn/generic/broot.c
--- a/mpn/generic/broot.c Wed Feb 27 19:47:36 2013 +0100
+++ b/mpn/generic/broot.c Thu Feb 28 12:00:45 2013 +0100
@@ -66,7 +66,7 @@
mpn_broot_invm1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t k)
{
mp_size_t sizes[GMP_LIMB_BITS * 2];
- mp_ptr akm1, tp, rnp, ep, scratch;
+ mp_ptr akm1, tp, rnp, ep;
mp_limb_t a0, r0, km1, kp1h, kinv;
mp_size_t rn;
unsigned i;
diff -r d4a2e4e0b904 -r f661d334106c mpz/ior.c
--- a/mpz/ior.c Wed Feb 27 19:47:36 2013 +0100
+++ b/mpz/ior.c Thu Feb 28 12:00:45 2013 +0100
@@ -89,7 +89,6 @@
if (op2_size < 0)
{
mp_ptr opx, opy;
- mp_limb_t cy;
/* Both operands are negative, so will be the result.
-((-OP1) | (-OP2)) = -(~(OP1 - 1) | ~(OP2 - 1)) =
diff -r d4a2e4e0b904 -r f661d334106c tests/mpn/t-brootinv.c
--- a/tests/mpn/t-brootinv.c Wed Feb 27 19:47:36 2013 +0100
+++ b/tests/mpn/t-brootinv.c Thu Feb 28 12:00:45 2013 +0100
@@ -63,7 +63,6 @@
{
mp_size_t n;
mp_limb_t k;
- int c;
n = 1 + gmp_urandomm_ui (rands, MAX_LIMBS);
diff -r d4a2e4e0b904 -r f661d334106c tests/mpn/t-hgcd_appr.c
--- a/tests/mpn/t-hgcd_appr.c Wed Feb 27 19:47:36 2013 +0100
+++ b/tests/mpn/t-hgcd_appr.c Thu Feb 28 12:00:45 2013 +0100
@@ -157,9 +157,6 @@
mpz_out_str (stderr, base, x); fputc ('\n', stderr);
}
-static int
-mpz_mpn_equal (const mpz_t a, mp_srcptr bp, mp_size_t bsize);
-
static mp_size_t
one_test (mpz_t a, mpz_t b, int i)
{
@@ -384,16 +381,6 @@
}
static int
-mpz_mpn_equal (const mpz_t a, mp_srcptr bp, mp_size_t bsize)
-{
- mp_srcptr ap = a->_mp_d;
- mp_size_t asize = a->_mp_size;
-
- MPN_NORMALIZE (bp, bsize);
- return asize == bsize && mpn_cmp (ap, bp, asize) == 0;
-}
-
-static int
hgcd_ref_equal (const struct hgcd_ref *A, const struct hgcd_ref *B)
{
unsigned i;
diff -r d4a2e4e0b904 -r f661d334106c tests/mpq/t-get_d.c
--- a/tests/mpq/t-get_d.c Wed Feb 27 19:47:36 2013 +0100
+++ b/tests/mpq/t-get_d.c Thu Feb 28 12:00:45 2013 +0100
@@ -171,7 +171,6 @@
int exp;
int test, reps = 100000;
- int i;
if (argc == 2)
reps = 100 * atoi (argv[1]);
diff -r d4a2e4e0b904 -r f661d334106c tests/mpz/t-bin.c
--- a/tests/mpz/t-bin.c Wed Feb 27 19:47:36 2013 +0100
+++ b/tests/mpz/t-bin.c Thu Feb 28 12:00:45 2013 +0100
@@ -212,9 +212,7 @@
smallexaustive (unsigned int count)
{
mpz_t n_z, want;
- unsigned long n, k, i, r;
- int tests;
- gmp_randstate_ptr rands;
+ unsigned long n, k;
mpz_init (n_z);
mpz_init (want);
diff -r d4a2e4e0b904 -r f661d334106c tests/mpz/t-jac.c
--- a/tests/mpz/t-jac.c Wed Feb 27 19:47:36 2013 +0100
+++ b/tests/mpz/t-jac.c Thu Feb 28 12:00:45 2013 +0100
@@ -912,8 +912,6 @@
for (i = 0; i < COUNT; i++)
{
- unsigned j;
- unsigned chain_len;
int answer;
mp_bitcnt_t msize;
diff -r d4a2e4e0b904 -r f661d334106c tests/mpz/t-limbs.c
--- a/tests/mpz/t-limbs.c Wed Feb 27 19:47:36 2013 +0100
+++ b/tests/mpz/t-limbs.c Thu Feb 28 12:00:45 2013 +0100
@@ -64,6 +64,7 @@
if (mpz_cmp (r, ref) != 0)
{
printf ("%s failed, abits %u, bbits %u\n",
+ name,
(unsigned) mpz_sizeinbase (a, 2),
(unsigned) mpz_sizeinbase (b, 2));
gmp_printf ("a = %Zx\n", a);
@@ -100,7 +101,6 @@
mp_size_t an = mpz_size (a);
mp_size_t bn = mpz_size (b);
mp_srcptr ap, bp;
- mp_ptr rp;
TMP_DECL;
TMP_MARK;
@@ -143,7 +143,7 @@
check_mul (void)
{
gmp_randstate_ptr rands = RANDS;
- mpz_t bs, a, b, r, ref;
+ mpz_t bs, a, b;
unsigned i;
mpz_inits (bs, a, b, NULL);
for (i = 0; i < COUNT; i++)
diff -r d4a2e4e0b904 -r f661d334106c tests/mpz/t-mfac_uiui.c
--- a/tests/mpz/t-mfac_uiui.c Wed Feb 27 19:47:36 2013 +0100
+++ b/tests/mpz/t-mfac_uiui.c Thu Feb 28 12:00:45 2013 +0100
@@ -66,7 +66,7 @@
MPZ_CHECK_FORMAT (res);
if (mpz_cmp (ref[m], res) != 0)
{
- printf ("mpz_mfac_uiui(%lu,&i) wrong\n", n, MULTIFAC_WHEEL);
+ printf ("mpz_mfac_uiui(%lu,%d) wrong\n", n, MULTIFAC_WHEEL);
printf (" got "); mpz_out_str (stdout, 10, res); printf("\n");
printf (" want "); mpz_out_str (stdout, 10, ref[m]); printf("\n");
abort ();
@@ -75,7 +75,7 @@
MPZ_CHECK_FORMAT (res);
if (mpz_cmp (ref2[m2], res) != 0)
{
- printf ("mpz_mfac_uiui(%lu,&i) wrong\n", n, MULTIFAC_WHEEL2);
+ printf ("mpz_mfac_uiui(%lu,%d) wrong\n", n, MULTIFAC_WHEEL2);
printf (" got "); mpz_out_str (stdout, 10, res); printf("\n");
printf (" want "); mpz_out_str (stdout, 10, ref2[m2]); printf("\n");
abort ();
More information about the gmp-commit
mailing list