Skip to content

Commit 010a03c

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

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
CORE
22
main.c
33
--unwind 10 --unwinding-assertions
4+
^\[main.unwind.1\] line 5 unwinding assertion loop 0: SUCCESS$
45
^EXIT=0$
56
^SIGNAL=0$
67
^VERIFICATION SUCCESSFUL$
78
--
89
^warning: ignoring
10+
^\[main.\d+\] line 5 assertion: SUCCESS$

src/goto-instrument/unwind.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,13 @@ 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_comment(
160+
"unwinding assertion loop " + loop_number);
156161
goto_programt::targett assertion = rest_program.add(
157-
goto_programt::make_assertion(exit_cond, loop_head->source_location()));
162+
goto_programt::make_assertion(exit_cond, source_location_annotated));
158163
unwind_log.insert(assertion, loop_head->location_number);
159164
}
160165

0 commit comments

Comments
 (0)