Skip to content

Commit f0e2f32

Browse files
committed
goto-instrument --unwind: identify loop unwinding assertions as such
We previously generated an assertion without setting either comments or property_ids. Make sure verification reports allow the user to understand what the failing/succeeding assertion is about.
1 parent a7899ab commit f0e2f32

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

regression/goto-instrument/unwind-assert1/test.desc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
CORE
22
main.c
33
--unwind 10 --unwinding-assertions
4+
^\[main.unwind.0\] line 5 unwinding assertion loop 0: SUCCESS$
45
^EXIT=0$
56
^SIGNAL=0$
67
^VERIFICATION SUCCESSFUL$

src/goto-instrument/unwind.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,15 @@ void goto_unwindt::unwind(
153153
unwind_strategy == unwind_strategyt::ASSERT_ASSUME ||
154154
unwind_strategy == unwind_strategyt::ASSERT_PARTIAL)
155155
{
156+
const std::string loop_number = std::to_string(t->loop_number);
157+
source_locationt source_location_annotated = loop_head->source_location();
158+
source_location_annotated.set_property_class("unwind");
159+
source_location_annotated.set_property_id(
160+
id2string(function_id) + ".unwind." + loop_number);
161+
source_location_annotated.set_comment(
162+
"unwinding assertion loop " + loop_number);
156163
goto_programt::targett assertion = rest_program.add(
157-
goto_programt::make_assertion(exit_cond, loop_head->source_location()));
164+
goto_programt::make_assertion(exit_cond, source_location_annotated));
158165
unwind_log.insert(assertion, loop_head->location_number);
159166
}
160167

0 commit comments

Comments
 (0)