mini-gmp test suite could be improved

Vincent Lefevre vincent at
Wed Sep 5 15:43:29 UTC 2018

On 2018-09-05 16:00:18 +0200, Torbjorn Granlund wrote:
> paul zimmermann <Paul.Zimmermann at> writes:
>   void
>   mpz_add_ui (mpz_t r, const mpz_t a, unsigned long b)
>   {
>     b = b % 0xffffffff;
>     if (a->_mp_size >= 0)
>       r->_mp_size = mpz_abs_add_ui (r, a, b);
>     else
>       r->_mp_size = -mpz_abs_sub_ui (r, a, b);
>   }
> An interestng approach, patch the library to miscompute things in a way
> that the testsuite does not detect!

I intended to do that in MPFR to check that each MPFR_LIMB() macro
was really needed or something was missing in the test suite.

> Perhaps this can be automated and given a new, trendy name now that
> fuzzing has been on everybody's mind for so long? :-)

An interesting place is to check inequalities on integers, by adding
or subtracting 1 on one side. And some magic constants. But it could
also mean that there are several valid possibilities, and the language
would need to be extended to handle that.

Vincent Lefèvre <vincent at> - Web: <>
100% accessible validated (X)HTML - Blog: <>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

More information about the gmp-devel mailing list