Invalid read in mpz_sub
miham at beyondsemi.com
Thu Apr 7 07:50:08 UTC 2016
On 06. 04. 2016 17:39, Torbjörn Granlund wrote:
> When passing x by value, you make copies of the two contained mpz_t
> variables, including pointers. Then you cause reallocation of the
> original variables, making pointer your copies point to stale data.
That I know, I intentionally made it that way specifically to produce
the invalid read. If this is the intended behavior then the documentation
should clearly state that input and output function arguments should not
be copies of one another. Also the definition of mpz_t as one element
array of struct should be emphasized (not just mentioned by the way
"for interest" as in ) because it affects when the underlying struct
behaves as a reference type (e.g. when mpz_t is a function argument)
and when as a value type (e.g. when mpz_t is inside another struct).
More information about the gmp-bugs