Skip to content

Commit a761762

Browse files
committed
C front-end: pragma conflict checking must handle empty stack
We do not necessarily have any pragmas set, and therefore must be able to handle an empty stack. Surprisingly, this only seg faulted when building in exactly the way check-ubuntu-20_04-make-gcc is doing this in CI, and only on one test added in the next commit.
1 parent 8b7bed6 commit a761762

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/ansi-c/ansi_c_parser.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ void ansi_c_parsert::pragma_cprover_add_check(
203203

204204
bool ansi_c_parsert::pragma_cprover_clash(const irep_idt &name, bool enabled)
205205
{
206+
if(pragma_cprover_stack.empty())
207+
return false;
208+
206209
auto top = pragma_cprover_stack.back();
207210
auto found = top.find(name);
208211
return found != top.end() && found->second != enabled;

0 commit comments

Comments
 (0)