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

John McDermott jjm at mcs.st-and.ac.uk
Wed Mar 23 16:51:04 CET 2011

Dear Torbjorn, dear all,

On 14 Mar 2011, at 10:03, John McDermott wrote:

>> I don't have access to any core2 mac, so I can ot attempt to reproduce
>> this.
> We are trying to arrange access for ourselves to a larger pool of Macs, for testing with various architectures. If you would like to have access to a machine on which we can reproduce the problem we can probably arrange that in the near future.

I now have a couple of Apple Macs available and have done some further testing. Please let me know if you would like ssh access to these and we can arrange it off list.

These machines are a 64-bit Core 2 Duo and a 32-bit Core Duo (details appended below) with the same Apple version of gcc 4.2.1. I can reproduce the snprintf problem on each (in the former case this is not really new, but we didn't previously have the latter result).

Somewhat more surprisingly, I have built a version of gcc 4.5.2 from source on each machine and then used that to compile GMP 5.0.1 and again the compiled short test program (see message one in this thread) exhibits the print problem.

>> 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.
> I ran this for over ten minutes on my machine, in a build setup which exhibits the issue, and saw nothing interesting. Many lines like
> ...
> Seed GMP_CHECK_RANDOMIZE=975436106 (include this in bug reports)
> Seed GMP_CHECK_RANDOMIZE=2270808398 (include this in bug reports)
> ...
> were produced. And nothing else. I doubt you would be interested to see them all :) We reproduced this on another very similar Mac.

And this test was the same with the gcc 4.5.2 compiler - nothing interesting shows.

I tried to get some data using the clang compiler but so far cannot build GMP with this compiler on these platforms, though I have not tried very hard. I may get a chance to try further later and submit a bug report for that if appropriate.

Best wishes,

============== Test machines ==============

GMP version 5.0.1 on each. Both running Mac OS X 10.6 (Snow Leopard). Each has the same (XCode) gcc:

i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)

(My first tests on my own Mac had Apple build 5664.) 

And each has a plain build from source of gcc 4.5.2. Differences are:

Core 2 Duo (64)
config.guess: core2-apple-darwin10.6.0
configure option: ABI=32

Core Duo
config.guess: pentiumm-apple-darwin10.6.0
no option to configure

Results of running the test program (exactly as in the first message in this thread) are the same problem on each but with a somewhat different wrong number printed than I sent as the result from my machine:


John McDermott
Scientific Officer
Centre for Interdisciplinary Research in Computational Algebra
School of Computer Science
University of St Andrews

The University of St Andrews is committed to sustainable practices and the preservation of the environment.
Please do not print this email unless absolutely necessary.

The University of St Andrews is a charity registered in Scotland : No SC01353

More information about the gmp-bugs mailing list