Raw File
gmp-exception.patch
diff -r 842c2ba359bf errno.c
--- a/errno.c	Sun Jan 24 22:06:51 2016 +0100
+++ b/errno.c	Thu Jan 28 13:37:54 2016 -0500
@@ -33,24 +33,24 @@
 see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
+
+#include <signal.h>
+
 #include "gmp.h"
 #include "gmp-impl.h"
 
 int gmp_errno = 0;
 
 
-/* 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.
-
-   Enhancement: Perhaps raise(SIGFPE) (or the same with kill()) would be
-   better than abort.  Perhaps it'd be possible to get the BSD style
-   FPE_INTDIV_TRAP parameter in there too.  */
-
+/* Use SIGFPE on systems which have it. Otherwise, deliberate divide
+   by zero, which triggers an exception on most systems. On those
+   where it doesn't, for example power and powerpc, use abort instead. */
 void
 __gmp_exception (int error_bit)
 {
   gmp_errno |= error_bit;
   __gmp_junk = 10 / __gmp_0;
+  raise (SIGFPE);
   abort ();
 }
 
back to top