[Gmp-commit] /var/hg/gmp: Valgrind workaround.

mercurial at gmplib.org mercurial at gmplib.org
Wed Dec 5 22:14:25 CET 2012


details:   /var/hg/gmp/rev/71cab51c5bfe
changeset: 15162:71cab51c5bfe
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Wed Dec 05 22:14:22 2012 +0100
description:
Valgrind workaround.

diffstat:

 ChangeLog              |  3 +++
 mpn/generic/brootinv.c |  5 +++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diffs (27 lines):

diff -r 5a8d608b3d3f -r 71cab51c5bfe ChangeLog
--- a/ChangeLog	Wed Dec 05 21:37:31 2012 +0100
+++ b/ChangeLog	Wed Dec 05 22:14:22 2012 +0100
@@ -1,5 +1,8 @@
 2012-12-05  Niels Möller  <nisse at lysator.liu.se>
 
+	* mpn/generic/brootinv.c (mpn_brootinv): Make valgrind happier, at
+	the cost of a redundant MPN_ZERO.
+
 	* mpz/jacobi.c (mpz_jacobi): Check for asize == 0 or bsize == 0
 	before using the low limbs.
 
diff -r 5a8d608b3d3f -r 71cab51c5bfe mpn/generic/brootinv.c
--- a/mpn/generic/brootinv.c	Wed Dec 05 21:37:31 2012 +0100
+++ b/mpn/generic/brootinv.c	Wed Dec 05 22:14:22 2012 +0100
@@ -107,6 +107,11 @@
   if (bn == 1)
     return;
 
+  /* This initialization doesn't matter for the result (any garbage is
+     cancelled in the iteration), but proper initialization makes
+     valgrind happier. */
+  MPN_ZERO (rp+1, bn-1);
+
   d = 0;
   for (; bn > 1; bn = (bn + 1) >> 1)
     order[d++] = bn;


More information about the gmp-commit mailing list