[Gmp-commit] /var/hg/gmp: One more clang warning: don't point outside an arra...

mercurial at gmplib.org mercurial at gmplib.org
Sat Sep 21 11:56:35 CEST 2013


details:   /var/hg/gmp/rev/fe2e87b2b7b7
changeset: 16013:fe2e87b2b7b7
user:      Marc Glisse <marc.glisse at inria.fr>
date:      Sat Sep 21 11:56:32 2013 +0200
description:
One more clang warning: don't point outside an array, even temporarily without dereferencing.

diffstat:

 ChangeLog             |  1 +
 mpn/generic/get_str.c |  2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r c22ca3db7d7d -r fe2e87b2b7b7 ChangeLog
--- a/ChangeLog	Sat Sep 21 11:39:43 2013 +0200
+++ b/ChangeLog	Sat Sep 21 11:56:32 2013 +0200
@@ -2,6 +2,7 @@
 
 	* tests/mpn/t-mulmid.c: Cast arguments of printf to int to match %d.
 	* tests/rand/t-urbui.c: Use 1UL for unsigned constant.
+	* mpn/generic/get_str.c: Avoid temporarily pointing outside an array.
 
 2013-09-20  Torbjorn Granlund  <tege at gmplib.org>
 
diff -r c22ca3db7d7d -r fe2e87b2b7b7 mpn/generic/get_str.c
--- a/mpn/generic/get_str.c	Sat Sep 21 11:39:43 2013 +0200
+++ b/mpn/generic/get_str.c	Sat Sep 21 11:56:32 2013 +0200
@@ -535,7 +535,7 @@
 
   /* Using our precomputed powers, now in powtab[], convert our number.  */
   tmp = TMP_BALLOC_LIMBS (mpn_dc_get_str_itch (un));
-  out_len = mpn_dc_get_str (str, 0, up, un, powtab - 1 + pi, tmp) - str;
+  out_len = mpn_dc_get_str (str, 0, up, un, powtab + (pi - 1), tmp) - str;
   TMP_FREE;
 
   return out_len;


More information about the gmp-commit mailing list