From 288abb2859e37b603acedb5ea0bbf86a99b8a0ab Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Wed, 24 Jul 2024 21:52:34 +0300 Subject: [PATCH] Report error rather than crash on empty pop --- src/stab.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/stab.cpp b/src/stab.cpp index 00190ccc..06385d18 100644 --- a/src/stab.cpp +++ b/src/stab.cpp @@ -96,6 +96,13 @@ Block::fn_body_enter() void Block::exit() { + if (scope_block.empty()) + /* + * @error + * A #pragma block_exit was performed without + * having a corresponding active block. + */ + Error::error(E_FATAL, "#pragma block_exit on an empty block stack"); scope_block.pop_back(); current_block--; param_clear();