GMP 5.0.4 fails "make check" on sparc64 OpenBSD 5.0

Paul Leyland paul at
Sun Feb 12 18:18:00 CET 2012

On Sun, 2012-02-12 at 17:07 +0100, Torbjorn Granlund wrote:
> We started to see problems with a system in the GCC compile farm when it
> was upgraded from an earlier OpenBSD system to 5.0, a few weeks ago.
> The symptoms are non-reproducible 'make check' errors.
> Are the errors you see reproducible?  A failing test should fail after
> about the same time and with the same operands every time.  Only
> exception is if you explicitly ask the GMP test suite to seed the PRNGs
> (using an undocumented procedure).

I will try to find out.

> I have not completely analysed this problem, non-reproducible errors are
> evasive.  I have very carefully proofread relevant issues with one GMP
> file known to trigger to this problem (mpn/sparc64/addmul_1.asm).
> I think this is a bug in OpenBSD's context switching code for 64-bit
> sparc.  The register save areas for the register windows are sprinkled
> out in a funny way, with a sp (stack pointer) offset of 2047 [not a typo
> for 2048].  (IIRC, sp mod 16 = -1 in a 64-bit binary, the 2047 offset
> make it aligned.  At least, it is something along those lines.)  This
> might be confusing.

As noted in an earlier report, I intend to raise the issue with the
OpenBSD people.  Have you informed them of your findings?  If not, may I
forward a copy of this mail to them?

> You can make GMP work under this kernel by removing all files with "mul"
> in their file names under mpn/sparc64.  These files use FP registers and
> a stack frame, unlike most other assembly functions.

Thanks.  My real aim is to factor integers rather than to debug
libraries and it is good to have a simple workaround, albeit at a cost
of some performance.  That said, lower performance is far better than no
performance at all.

> Using very few GMP functions, this problem should be possible to
> reproduce with just
>        tests/devel/try mpn_mul_basecase
> and some patience.
> I have documented that ultrasparc[1234]-unknown-openbsd5.0 is
> unsupported (see
> PS. The same code works under Solaris, the kernel Linux, and in the past
> FreeBSD, as well as previous OpenBSD kernels.  This is no proof, but at
> least good evidence that it is not a GMP bug.  :-)

I agree.


More information about the gmp-bugs mailing list