I see. I failed to initialize the mpz_t. I have successfully used the C++ style many times before, but there doesn't seem to be a C++ version of mpz_invert.
Anyway, sorry about the bogus report. Álvaro. On Fri, Mar 24, 2017 at 7:26 PM Torbjörn Granlund <[email protected]> wrote: > Álvaro Begué <[email protected]> writes: > > mpz_class fraction_mod_m(mpq_class x, mpz_class m) { > mpz_t inverse; > mpz_class den = x.get_den(); > mpz_invert(inverse, den.get_mpz_t(), m.get_mpz_t()); // Crashes > return mpz_class(inverse); > } > > No GMP bug. > > Please re-read > > https://gmplib.org/manual/GMP-Basics.html, in particular > https://gmplib.org/manual/Variable-Conventions.html in order to use GMP > in C-style correctly. > > Why do you mix C++ style and C style? > > -- > Torbjörn > Please encrypt, key id 0xC8601622 > _______________________________________________ gmp-bugs mailing list [email protected] https://gmplib.org/mailman/listinfo/gmp-bugs
