[Gmp-commit] /var/hg/gmp-5.0: toom8h: corrected un unlikely borrow propagatio...

mercurial at gmplib.org mercurial at gmplib.org
Thu Feb 2 23:08:48 CET 2012


details:   /var/hg/gmp-5.0/rev/84db00493847
changeset: 13537:84db00493847
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu Feb 02 23:08:41 2012 +0100
description:
toom8h: corrected un unlikely borrow propagation spotted by Torbjorn and nightly tests.

diffstat:

 ChangeLog                            |  4 ++++
 mpn/generic/toom_interpolate_16pts.c |  8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r 226be98836aa -r 84db00493847 ChangeLog
--- a/ChangeLog	Thu Feb 02 21:25:46 2012 +0100
+++ b/ChangeLog	Thu Feb 02 23:08:41 2012 +0100
@@ -1,3 +1,7 @@
+2012-02-02 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpn/generic/toom_interpolate_16pts.c: Correct an unlikely 32-bit bug.
+
 2012-02-02  Torbjorn Granlund  <tege at gmplib.org>
 
 	* mpn/generic/toom63_mul.c: Allow s+t==n by adjusting an ASSERT.
diff -r 226be98836aa -r 84db00493847 mpn/generic/toom_interpolate_16pts.c
--- a/mpn/generic/toom_interpolate_16pts.c	Thu Feb 02 21:25:46 2012 +0100
+++ b/mpn/generic/toom_interpolate_16pts.c	Thu Feb 02 23:08:41 2012 +0100
@@ -6,7 +6,7 @@
    SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES.  IN FACT, IT IS ALMOST
    GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
 
-Copyright 2009, 2010 Free Software Foundation, Inc.
+Copyright 2009, 2010, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -299,11 +299,15 @@
     DO_mpn_subrsh(r5, n3p1, r0, spt, 4, wsi);
 
     cy = DO_mpn_sublsh_n (r1 + BIT_CORRECTION, r0, spt, 42 - CORRECTION_BITS, wsi);
-    MPN_DECR_U (r1 + spt + BIT_CORRECTION, n3p1 - spt - BIT_CORRECTION, cy);
 #if BIT_CORRECTION
+    cy = mpn_sub_1 (r1 + spt + BIT_CORRECTION, r1 + spt + BIT_CORRECTION,
+		    n3p1 - spt - BIT_CORRECTION, cy);
+    ASSERT (BIT_CORRECTION > 0 || cy == 0);
     /* FIXME: assumes r7[n3p1] is writable (it is if r5 follows). */
     cy = r7[n3p1];
     r7[n3p1] = 0x80;
+#else
+    MPN_DECR_U (r1 + spt + BIT_CORRECTION, n3p1 - spt - BIT_CORRECTION, cy);
 #endif
     DO_mpn_subrsh(r7, n3p1 + BIT_CORRECTION, r0, spt, 6, wsi);
 #if BIT_CORRECTION


More information about the gmp-commit mailing list