Segfaults during testing

Torbjörn Granlund tg at gmplib.org
Sat Jun 14 21:11:10 UTC 2014


Our nightly builds currently run with a stack limit of 320 KiB.  It
turns out that this is occasionally insufficient, triggering test
failures.

The culprit is not GMP per se, but the test support code in refmpn.c.
Therein, the function refmpn_mul calls itself recursively for unbalanced
operands.

When called for operands of 493508 and 493376 limbs respectively, after
an initial 493376 x 493376 multiply, the recursion will start chipping
away 493508-493376 = 132 limbs at a time, resulting in a recursion depth
of over 3700.  Some machines make large stack frames, e.g., powerpc64
with gcc gets 176 byte large frames.

This function needs to be improved to avoid this silly recursion.


Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-devel mailing list