~ chicken-core (chicken-5) 4568ac2a66a8a813f16d20483ee05460c8462dbb
commit 4568ac2a66a8a813f16d20483ee05460c8462dbb
Author: Jörg F. Wittenberger <Joerg.Wittenberger@softeyes.net>
AuthorDate: Sat Jun 13 10:38:28 2015 +0200
Commit: Mario Domenech Goulart <mario.goulart@gmail.com>
CommitDate: Sat Jun 13 16:24:14 2015 -0300
Add cases for unhandled error codes to `barf`.
Signed-off-by: Peter Bex <peter@more-magic.net>
Signed-off-by: Mario Domenech Goulart <mario.goulart@gmail.com>
diff --git a/NEWS b/NEWS
index 1ec580bd..a3393ba7 100644
--- a/NEWS
+++ b/NEWS
@@ -45,6 +45,8 @@
- Removed several deprecated and undocumented internal procedures:
##sys#zap-strings, ##sys#round, ##sys#foreign-number-vector-argument,
##sys#check-port-mode, ##sys#check-port*
+ - SIGBUS, SIGILL and SIGFPE will now cause proper exceptions instead
+ of panicking (thanks to Joerg Wittenberger).
- Module system
- Allow functor arguments to be optional, with default implementations.
diff --git a/runtime.c b/runtime.c
index 8267954d..75ca6549 100644
--- a/runtime.c
+++ b/runtime.c
@@ -1753,6 +1753,21 @@ void barf(int code, char *loc, ...)
c = 0;
break;
+ case C_FLOATING_POINT_EXCEPTION_ERROR:
+ msg = C_text("floating point exception");
+ c = 0;
+ break;
+
+ case C_ILLEGAL_INSTRUCTION_ERROR:
+ msg = C_text("illegal instruction");
+ c = 0;
+ break;
+
+ case C_BUS_ERROR:
+ msg = C_text("bus error");
+ c = 0;
+ break;
+
default: panic(C_text("illegal internal error code"));
}
Trap