Skip to content

Commit dff27a3

Browse files
committed
Fix ignoring properties before unwind min (off-by-one)
Basically, if unwind-min is zero (by default) the first loop iterations should not be ignored (even if requested). Tests show the problem.
1 parent 39c5ac8 commit dff27a3

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
main.c
3+
--ignore-properties-before-unwind-min --incremental-loop main.0 --unwind-max 2
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[main.assertion.\d+\] line \d+ property: FAILURE$
7+
^VERIFICATION FAILED$
8+
--
9+
^warning: ignoring
10+
--
11+
This test correctly fails because the first iteration of the loop violates the
12+
property.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
int main()
2+
{
3+
__CPROVER_bool property = (__CPROVER_bool)1;
4+
5+
while(1)
6+
{
7+
__CPROVER_assume(property == 1);
8+
property = 0;
9+
__CPROVER_assert(property == 1, "property");
10+
}
11+
return 0;
12+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CORE
2+
main.c
3+
--ignore-properties-before-unwind-min --incremental-loop main.0 --unwind-max 2 --unwind-min 1
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
9+
--
10+
This test "correctly" succeeds because the second iteration of the loop is
11+
unreachable due to the assumption which is violated after the first iteration.
12+
This behaviour is intended and documented, i.e. using ignore-before-unwind
13+
assumes that we know that iterations before unwind-min are correct.

src/goto-checker/symex_bmc_incremental_one_loop.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ symex_bmc_incremental_one_loopt::symex_bmc_incremental_one_loopt(
3636
: 0)
3737
{
3838
ignore_assertions =
39+
incr_min_unwind >= 1 &&
3940
options.get_bool_option("ignore-properties-before-unwind-min");
4041
}
4142

0 commit comments

Comments
 (0)