From 7008ab020f553d42c1b65c62f95709e893a109ce Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Sat, 13 Jun 2015 14:32:07 +0200 Subject: [PATCH] Add cases for unhandled error codes to `barf`. Signed-off-by: Peter Bex --- NEWS | 2 ++ runtime.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/NEWS b/NEWS index 3fde30a..1af6417 100644 --- a/NEWS +++ b/NEWS @@ -67,6 +67,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 1200183..9d69335 100644 --- a/runtime.c +++ b/runtime.c @@ -1829,6 +1829,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; + case C_BAD_ARGUMENT_TYPE_NO_EXACT_ERROR: msg = C_text("bad argument type - not an exact number"); c = 1; -- 2.1.4