Skip to content

Commit 4c2c27d

Browse files
committed
Single-path symex must not fail an invariant when verification succeeds
Single-path symex takes a best-effort approach to produce a proof by using the symex equation of that path that was last visited. This, however, failed an invariant when trying to access the equation that had already been popped from the worklist. Leave the last equation in place to avoid this problem.
1 parent 770d791 commit 4c2c27d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

regression/cbmc/Address_of1/test.desc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
CORE
22
main.c
3-
3+
--stop-on-fail
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$
77
--
88
^warning: ignoring
9+
--
10+
Adding "--stop-on-fail" should not make a difference for successful
11+
verification, but previously caused an invariant failure when running CBMC with
12+
"--paths."

src/goto-checker/single_path_symex_checker.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ operator()(propertiest &properties)
7575
return result;
7676
}
7777

78+
// leave the last worklist item in place for the benefit of output_proof
79+
if(worklist->size() == 1)
80+
break;
81+
7882
worklist->pop();
7983
}
8084

@@ -83,7 +87,7 @@ operator()(propertiest &properties)
8387

8488
final_update_properties(properties, result.updated_properties);
8589

86-
// Worklist is empty: we are done.
90+
// Worklist just has the last element left: we are done.
8791
return result;
8892
}
8993

@@ -182,6 +186,8 @@ void single_path_symex_checkert::output_error_witness(
182186
void single_path_symex_checkert::output_proof()
183187
{
184188
// This is incorrect, but the best we can do at the moment.
189+
// operator()(propertiest &properties) leaves in place the last worklist item
190+
// just for this purpose.
185191
const path_storaget::patht &resume = worklist->peek();
186192
output_graphml(resume.equation, ns, options);
187193
}

0 commit comments

Comments
 (0)