New failures related to recent developments

Niels Möller nisse at
Tue Feb 28 09:35:27 CET 2012

Torbjorn Granlund <tg at> writes:

> I compared mpn/fib_table.c with a system that did not report any
> failures (but this table to was generated with mini-gmp.c).  They have
> the same contents.

I compared the output of gen-fib table 32 0, in current gmp and
gmp-5.0.2. Result is identical on my machine.

> But fib-table.h has
> #define FIB_TABLE_LIMIT         47
> on one of the failing systems and
> #define FIB_TABLE_LIMIT         47

I also get 


for both current and gmp-5.0.2. So I think we can conclude that's the
correct definition.

I'm not entirely sure I understand fib-gen is supposed work. luc_limit
is only assigned like this, in gen-fib.c:generate,

      if (mpz_cmp (l, limit) < 0)
	luc_limit = i-1;
Looking at mini-gmp.c:mpz_cmp, I've spotted one bug, but I think
that's unrelated since it affects negative numbers only.

diff -r e21157bb513d mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c	Mon Feb 27 14:37:02 2012 +0100
+++ b/mini-gmp/mini-gmp.c	Tue Feb 28 09:26:59 2012 +0100
@@ -1694,7 +1694,7 @@ mpz_cmp (const mpz_t a, const mpz_t b)
   else if (asize > 0)
     return mpn_cmp (a->_mp_d, b->_mp_d, asize);
   else if (asize < 0)
-    return -mpn_cmp (a->_mp_d, b->_mp_d, asize);
+    return -mpn_cmp (a->_mp_d, b->_mp_d, -asize);
     return 0;


Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.

More information about the gmp-devel mailing list