There is a systematic problem in mini-gmp.c when MPZ_REALLOC is called when a destination variable is the same as some other (source or destination) variable. After MPZ_REALLOC, all cached pointers must be considered to be defunct. I've spotted this error in 4 functions, but I haven't made a proper code review. -- Torbjörn