Take into account that GMP operations can move data

Need to follow forwarding pointers in case a garbage collection takes
place during the operation.

Note that there is still a memory leak in the way we use GMP - there is
never a call to mpz_clear in the right place.