Skip to content

Commit d310d2c

Browse files
authored
Merge pull request #3055 from NlightNFotis/fix_case_range_behaviour
Fix handling of case range statement in special case
2 parents 755d839 + 5da7d4f commit d310d2c

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-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$
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
int main()
2+
{
3+
int x;
4+
switch(x)
5+
{
6+
case 10 ... 0:
7+
break;
8+
}
9+
return 0;
10+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^Invariant check failed

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)