~ chicken-core (chicken-5) 50dfa0f37bc0dada3406eddde05b225e9498682e
commit 50dfa0f37bc0dada3406eddde05b225e9498682e Author: Peter Bex <peter@more-magic.net> AuthorDate: Sat Jun 13 14:32:07 2015 +0200 Commit: Mario Domenech Goulart <mario.goulart@gmail.com> CommitDate: Sat Jun 13 11:16:53 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 484f4cfa..b5c7d4b8 100644 --- a/NEWS +++ b/NEWS @@ -69,6 +69,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 0abe045f..63df536a 100644 --- a/runtime.c +++ b/runtime.c @@ -1833,6 +1833,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;Trap