Pull request: Raise SIGFPE instead of abort in __gmp_exception`
yyc1992 at gmail.com
Sat Jan 2 21:57:45 UTC 2016
This implements the `Enhancement` for `__gmp_exception`. I'm not sure
how to attach additional information on the signal so I leave that
We (julia) catches the SIGFPE generated by GMP and raise our own
error. Given the comment in this file, I think this is a reasonable
thing to do.
I'm pretty sure gmail will destroy the formatting of the patch so I
attached a link to a gist of the patch too.
Hopefully this is the right place to suggest patches.
Happy new year.
# HG changeset patch
# User Yichao Yu <yyc1992 at gmail.com>
# Date 1451770649 18000
# Sat Jan 02 16:37:29 2016 -0500
# Node ID 73752db1e2f346a6ee321116ebf2dd88361788a6
# Parent 60c77e71e1d3322567642dbd1919aa8b7531a822
Raise SIGFPE instead of abort in __gmp_exception on platforms that
doesn't do that automatically for integer zero division.
diff -r 60c77e71e1d3 -r 73752db1e2f3 errno.c
--- a/errno.c Fri Jan 01 21:41:57 2016 +0100
+++ b/errno.c Sat Jan 02 16:37:29 2016 -0500
@@ -33,6 +33,7 @@
see https://www.gnu.org/licenses/. */
@@ -40,10 +41,9 @@
/* The deliberate divide by zero triggers an exception on most systems. On
- those where it doesn't, for example power and powerpc, use abort instead.
+ those where it doesn't, for example power and powerpc, raise SIGFPE instead.
- Enhancement: Perhaps raise(SIGFPE) (or the same with kill()) would be
- better than abort. Perhaps it'd be possible to get the BSD style
+ Enhancement: Perhaps it'd be possible to get the BSD style
FPE_INTDIV_TRAP parameter in there too. */
@@ -51,7 +51,7 @@
gmp_errno |= error_bit;
__gmp_junk = 10 / __gmp_0;
- abort ();
+ raise (SIGFPE);
More information about the gmp-devel