segmentation error while using mpz_powm in a loop

Paul Zimmermann Paul.Zimmermann at
Fri May 8 10:10:55 CEST 2009

> I am getting segmentation fault in the program below.
> I have initialised all the GMP variables properly...
> But still i am getting segmentation fault at  *mpz_powm( );
> *The loop runs only once and second time it gives segmentation fault at
> mpz_powm...
> *
> The code is as follows: [...]

without a complete code we cannot reproduce your problem. I suggest you try
to print the values of your variables before the mpz_powm call, with say
gmp_printf. If you still get a segmentation fault *inside* the mpz_powm call,
please send your complete program to the list.

Paul Zimmermann

More information about the gmp-bugs mailing list