6.0.0 crash at high precision mul?

Torbjörn Granlund tg at gmplib.org
Sat Jun 7 15:46:46 UTC 2014


Triggered by your inquiry, we have analysed the stack usage of GMP 6.0.

It turned out that two allocation points (both in mpn/generic/mul.c)
made oversized stack allocations.  The result is that GMP could use at
least 1152 KiB of total stack.

I've patched the repositories for GMP 6.0 as well as the mainline.  Here
is the patch: https://gmplib.org/repo/gmp-6.0/raw-rev/84965a50fd92

With this patch applied, GMP's test suite uses less than 496 KiB.
Presumably this is a good figure for the maximal GMP use.

(According to Apple's documentation, the pthreads default stack size is
512 KiB, as David Harvey experienced.  "Carbon MPTasks", whatever that
might be, default to just 4 KiB.  Ref:
https://developer.apple.com/library/mac/qa/qa1419/_index.html)


Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-discuss mailing list