mpz reuse test takes too much time

Niels Möller nisse at
Wed Sep 28 14:12:26 UTC 2016

tg at (Torbjörn Granlund) writes:

> It is supposed to take a lot of time, as it tests all mpz functions for
> correct operand overlap.

There seem to be 160 mpz functions (checking the libgmp which is installed on my
office machine).

For a two-operand function, there are two cases, aa and ab (where my
notation is that distinct letters are distinct locations).

For a three-operand function, there are 5 cases, aaa, aab,
aba, abb, abc.

For a four-operand function, we get 14 distinct cases (and I'm losing
confidence that I get the combinatorics right), and for a five-operand
function like gcdext, I can't easily get the correct count but it must
be < 5^4 = 625. Do we have any function with more than 5 arguments?

Then we shouldn't need more than a few 100000 calls cover all cases, and
we shouldn't need very large operands. Is 10--40 seconds reasonable for


Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.

More information about the gmp-bugs mailing list