
Roberto Bagnara bagnara@cs.unipr.it writes:
it looks like I was not very successful in explaining why we absolutely need GMP to be compiled with exception support (and, in the long run, to be exception-safe).
Throwing exceptions from the mp_set_memory_functions routines is not currently supported, and probably leaks memory and leaves variables in inconsistent states (which you mentioned before perhaps).
The situation might not quite be as bad as it seems, since all allocations will have gone through those memory functions, so perhaps that provides a means to clean up. Depends on the intended use I guess.
Exceptions from divide-by-zero or sqrt-of-negative might be more hopeful, since those things at least can be (or ought to be) tested at the start of relevant gmp routines. Currently a deliberate "int" divide-by-zero is induced, so it might work to catch SIGFPE or the like, on those chips which raise that.