Skip to content

Commit 7685476

Browse files
committed
Fix handling of case range statement in special case
In the case where a gcc case range switch statement has a case that reduces to an empty expression, both gcc and clang reluctantly accept it, producing warnings. CBMC up until now was asserting against that case, and this divergence in behaviour was unwanted.
1 parent 3705a60 commit 7685476

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

regression/ansi-c/goto_convert_switch_range_empty/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG
1+
CORE
22
main.c
33

44
^EXIT=0$

src/goto-programs/goto_convert.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,8 @@ void goto_convertt::convert_switch(
12491249
{
12501250
const caset &case_ops=case_pair.second;
12511251

1252-
assert(!case_ops.empty());
1252+
if (case_ops.empty())
1253+
continue;
12531254

12541255
exprt guard_expr=case_guard(argument, case_ops);
12551256

0 commit comments

Comments
 (0)