aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_emu.c
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2019-03-25 15:31:27 +0100
committerJohn Högberg <[email protected]>2019-03-25 16:41:12 +0100
commitdfb3cbbc7918ccc2e281a86da86adbc517c43745 (patch)
tree186290a2eaf87e663531a0fb80f03132866b185e /erts/emulator/beam/beam_emu.c
parentedb8aa4f76981c1f32c9b429f47ce30100126e58 (diff)
downloadotp-dfb3cbbc7918ccc2e281a86da86adbc517c43745.tar.gz
otp-dfb3cbbc7918ccc2e281a86da86adbc517c43745.tar.bz2
otp-dfb3cbbc7918ccc2e281a86da86adbc517c43745.zip
erts: Add an explanation for the empty stack check in next_catch
Diffstat (limited to 'erts/emulator/beam/beam_emu.c')
-rw-r--r--erts/emulator/beam/beam_emu.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index 73bf443372..f1d8609066 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -1480,7 +1480,16 @@ next_catch(Process* c_p, Eterm *reg) {
ptr = prev = c_p->stop;
ASSERT(ptr <= STACK_START(c_p));
- if (ptr == STACK_START(c_p)) return NULL;
+
+ /* This function is only called if we have active catch tags or have
+ * previously called a function that was exception-traced. As the exception
+ * trace flag isn't cleared after the traced function returns (and the
+ * catch tag inserted by it is gone), it's possible to land here with an
+ * empty stack, and the process should simply die when that happens. */
+ if (ptr == STACK_START(c_p)) {
+ ASSERT(!active_catches && IS_TRACED_FL(c_p, F_EXCEPTION_TRACE));
+ return NULL;
+ }
/*
* Better safe than sorry here. In debug builds, produce a core