Pull request: Raise SIGFPE instead of abort in __gmp_exception`
nisse at lysator.liu.se
Thu Jan 7 20:45:44 UTC 2016
Yichao Yu <yyc1992 at gmail.com> writes:
> We (julia) catches the SIGFPE generated by GMP and raise our own
Out of curiosity, what are you doing on error? Display a message and
exit the process, or do you try to continue? At the very least, you
could suffer memory leaks, and perhaps leave other gmp objects in an
Maybe it would be simple and helpful to add a global error callback
pointer (where you could install a function looking up some thread-local
storage, if you want something thread-specific). But robust cleanup from
errors is quite tricky (it has been discussed on list from time to
time, one possibility is to combine it with custom memory allocators
with markers, and let the error handler longjmp out and clean up and
deallocate transient storage).
That said, it sounds reasonable to me to replace abort by raise(SIGFPE).
A configure check may be needed; I think both abort and raise are ANSI
C, but I suspect SIGFPE isn't.
Depending on pthreads functions is undesirable.
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
More information about the gmp-devel