bug in mpz_urandomm

Pierrick Gaudry pierrick.gaudry at gmail.com
Thu Mar 12 19:48:13 CET 2009


Section 3.4 of the manual says:
  " GMP lets you use the same variable for both input and output in one
And in Section 5.13, there is no exception for mpz_urandomm(). However
the implementation (in 4.2.4, at least), does not allow the first
parameter (the result) to be the third one (the bound). See for instance
the line 72 of mpz/urandomm.c that compares n and rp, but n can be
clobbered just the line before, if it's an alias to rp.

So I think this is a bug in the code, or in the documentation (I have no
objection to mpz_urandomm() not allowing aliases, but this should be



More information about the gmp-bugs mailing list