Version 4.1.4: gmp_printf() fails.
Torbjorn Granlund
tege at swox.com
Tue Jan 31 18:15:04 CET 2006
Henrik Johansson <mhrkjohansson at gmail.com> writes:
The following program fails with a "Segmentation fault" when compiled
and run on both a cygwin and a debian system.
------------------------------------------
#include <stdio.h>
#include <gmp.h>
int
main(int argc, char *argv[])
{
mpz_t res;
mpz_init_set_ui(res, 1);
mpz_mul_2exp(res, res, 30402457);
mpz_sub_ui(res, res, 1);
gmp_printf("%Zd", res);
mpz_clear(res);
return 0;
}
------------------------------------------
This is almost surely stack overflow on your machine.
Please see Q3 under http://swox.com/gmp/#FAQ.
--
Torbjörn
More information about the gmp-bugs
mailing list