diff options
| author | Mattias EngdegÄrd | 2022-01-12 17:18:48 +0100 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2022-01-12 17:18:48 +0100 |
| commit | 7875ce7365403522c6aa53c0ac892a6edb7403bd (patch) | |
| tree | 64b3c8fc1129d07c0d892613ec6e2b333fbdbe55 /src/bytecode.c | |
| parent | 712237cab6bc1c4fc326818a5c4e1f9bbdf45de7 (diff) | |
| download | emacs-7875ce7365403522c6aa53c0ac892a6edb7403bd.tar.gz emacs-7875ce7365403522c6aa53c0ac892a6edb7403bd.zip | |
Don't crash on unbalanced unwinds in debug mode
* src/bytecode.c (exec_byte_code):
Restore the previous graceful error (instead of a hard crash) when the
bytecode doesn't unwind properly, but only when building with
debugging (NDEBUG not defined, checking enabled, or BYTE_CODE_SAFE
enabled).
Diffstat (limited to 'src/bytecode.c')
| -rw-r--r-- | src/bytecode.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/bytecode.c b/src/bytecode.c index 41455629cb9..0bca2546f7f 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -1588,10 +1588,17 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 1588 | 1588 | ||
| 1589 | exit: | 1589 | exit: |
| 1590 | 1590 | ||
| 1591 | #if BYTE_CODE_SAFE || !defined NDEBUG | ||
| 1592 | if (SPECPDL_INDEX () != count) | ||
| 1593 | { | ||
| 1594 | /* Binds and unbinds are supposed to be compiled balanced. */ | ||
| 1595 | if (SPECPDL_INDEX () > count) | ||
| 1596 | unbind_to (count, Qnil); | ||
| 1597 | error ("binding stack not balanced (serious byte compiler bug)"); | ||
| 1598 | } | ||
| 1599 | #endif | ||
| 1591 | /* The byte code should have been properly pinned. */ | 1600 | /* The byte code should have been properly pinned. */ |
| 1592 | eassert (SDATA (bytestr) == bytestr_data); | 1601 | eassert (SDATA (bytestr) == bytestr_data); |
| 1593 | /* Binds and unbinds are supposed to be compiled balanced. */ | ||
| 1594 | eassert (SPECPDL_INDEX () == count); | ||
| 1595 | 1602 | ||
| 1596 | Lisp_Object result = TOP; | 1603 | Lisp_Object result = TOP; |
| 1597 | SAFE_FREE (); | 1604 | SAFE_FREE (); |