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 [1]) 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). Best regards, Miha Marolt [1] https://gmplib.org/manual/Parameter-Conventions.html#Parameter-Conventions _______________________________________________ gmp-bugs mailing list [email protected] https://gmplib.org/mailman/listinfo/gmp-bugs
