There is a known problem with the GnuMP, where it requires a lot of stack space for some computations, e.g. IntInf.toString of a million digit number. If you run with stack size limited, you may see a segfault in such programs. This problem is mentioned in the GnuMP FAQ, where they describe two solutions.
-
Increase (or unlimit) your stack space. From your program, use setrlimit, or from the shell, use ulimit.
-
Configure and rebuild libgmp with --disable-alloca, which will cause it to allocate temporaries using malloc instead of on the stack.