-
-
Save yuyichao/6d8a65ff3e5f8d142593 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HG changeset patch | |
# User Yichao Yu <yyc1992@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/. */ | |
#include <stdlib.h> | |
+#include <signal.h> | |
#include "gmp.h" | |
#include "gmp-impl.h" | |
@@ -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. */ | |
void | |
@@ -51,7 +51,7 @@ | |
{ | |
gmp_errno |= error_bit; | |
__gmp_junk = 10 / __gmp_0; | |
- abort (); | |
+ raise (SIGFPE); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment