mpz reuse test takes too much time

Marco Bodrato bodrato at mail.dm.unipi.it
Sat Dec 3 02:32:28 UTC 2016


Ciao,

Il Ven, 2 Dicembre 2016 11:50 pm, Torbjörn Granlund ha scritto:
> Target operands which are not also input operands are now overwritten
> with garbage via the CLOBBER macro.  (It would make sense to do this in
> almost every other GMP test file.)

I like the macro.

> I split your gcdext check macros into 2-operand and 3-operand variants.
> The old macros checked res3 even when it was not part of the
> computation, exhibiting possibly undefined behaviour.

> ! #define GCDEXT_CHECK2(i1, i2) do {					\
> ! 	    mpz_gcdext (res1, res2, NULL, i1, i2);			\
> ! 	    MPZ_CHECK_FORMAT (res1);					\
> ! 	    MPZ_CHECK_FORMAT (res2);					\
> ! 	    if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)	\
> ! 	      FAIL2 (mpz_gcdext, i1, i2, NULL);				\
> ! 	  } while (0)

Should we check both mpz_gcdext (res1, res2, NULL, i1, i2); and mpz_gcdext
(res1, NULL, res2, i2, i1) in this macro?

Since we currently support NULL also for the first argument, should we
check also the cases
mpz_gcdext (NULL, x, y, x, y);
mpz_gcdext (NULL, y, x, x, y);
mpz_gcdext (NULL, s, y, x, y); mpz_gcdext (NULL, y, t, y, x);
mpz_gcdext (NULL, s, x, x, y); mpz_gcdext (NULL, x, t, y, x);
mpz_gcdext (NULL, NULL, y, x, y); mpz_gcdext (NULL, x, NULL, x, y);
mpz_gcdext (NULL, NULL, x, x, y); mpz_gcdext (NULL, y, NULL, x, y); ?

I assume nobody will ever use mpz_gcdext (*, NULL, NULL, *, *), because
gcd() can de used instead...

Regards,
m

-- 
http://bodrato.it/



More information about the gmp-devel mailing list