Skip to content

Fix handling of case range statement in special case #3055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
KNOWNBUG
CORE
main.c

^EXIT=0$
Expand Down
10 changes: 10 additions & 0 deletions regression/ansi-c/goto_convert_switch_range_empty_nodefault/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
int main()
{
int x;
switch(x)
{
case 10 ... 0:
break;
}
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c

^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
^Invariant check failed
3 changes: 2 additions & 1 deletion src/goto-programs/goto_convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,8 @@ void goto_convertt::convert_switch(
{
const caset &case_ops=case_pair.second;

assert(!case_ops.empty());
if (case_ops.empty())
continue;

exprt guard_expr=case_guard(argument, case_ops);

Expand Down