v5.0.1, Mac, 32-bit: gmp_snprintf problem for (high) multi-limb integers

Torbjorn Granlund tg at gmplib.org
Thu Mar 10 23:57:18 CET 2011

Thanks for you excellent report!

I don't have access to any core2 mac, so I can ot attempt to reproduce

Question: When you compile the failing test, are you sure you get the
proper gmp.h?  It is a generated file, meaning that it will not support
both a 32-bit build and a 32-bit build.

I am surprised that the GMP testsuite does not catch this problem.

Please try the following:

  cd tests/mpz
  while true; do GMP_CHECK_RANDOMIZE=1 ./convert || break; done

Let it then run for a couple of minutes.

  Experiments seem to show this issue turns up around the stage when the
  numbers involved are getting as big as 22 limbs or so.
Non-incidentally, at 22 limbs, mpn_get_str will change algorithm, see
the last lines of gmp-mparam.h in the top level build dir.


More information about the gmp-bugs mailing list