GMP 5.0.4 fails "make check" on sparc64 OpenBSD 5.0

Torbjorn Granlund tg at gmplib.org
Sun Feb 12 17:07:44 CET 2012


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 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.

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.

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 https://gmplib.org/#STATUS).

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.  :-)

-- 
Torbjörn


More information about the gmp-bugs mailing list