File tree Expand file tree Collapse file tree 9 files changed +52
-20
lines changed
contracts/function_check_04 Expand file tree Collapse file tree 9 files changed +52
-20
lines changed Original file line number Diff line number Diff line change 1+ #include <assert.h>
2+
3+ static int foo ()
4+ {
5+ assert (1 < 0 );
6+ }
7+
8+ void bar ()
9+ {
10+ foo ();
11+ }
Original file line number Diff line number Diff line change 1+ #include <assert.h>
2+
3+ static int foo ()
4+ {
5+ assert (0 );
6+ }
7+
8+ void bar ();
9+
10+ int main ()
11+ {
12+ foo ();
13+ bar ();
14+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+ bar.c
4+ ^EXIT=10$
5+ ^SIGNAL=0$
6+ ^VERIFICATION FAILED$
7+ --
8+ ^warning: ignoring
9+ assertion\.2
10+ --
11+ Each of the assertions in the two functions named "foo" should have a unique
12+ prefix, and thus be numbered "<prefix>.assertion.1."
Original file line number Diff line number Diff line change 44^EXIT=10$
55^SIGNAL=0$
66^\[main.assertion.1\] .* assertion x == 0: SUCCESS$
7- ^\[foo .1\] line 9 .*: FAILURE$
7+ ^\[__CPROVER_initialize .1\] line 9 .*: FAILURE$
88^VERIFICATION FAILED$
99--
1010--
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ void aggressive_slicert::doit()
100100 auto property_loc = find_property (p, goto_model.goto_functions );
101101 if (!property_loc.has_value ())
102102 throw " unable to find property in call graph" ;
103- note_functions_to_keep (property_loc. value (). get_function () );
103+ note_functions_to_keep (property_loc-> first );
104104 }
105105
106106 // Add functions within distance of shortest path functions
Original file line number Diff line number Diff line change @@ -67,13 +67,12 @@ void label_properties(
6767 it->source_location_nonconst ().set_function (function_identifier);
6868 }
6969
70- irep_idt function = it->source_location ().get_function ();
70+ PRECONDITION (!function_identifier.empty ());
71+ std::string prefix = id2string (function_identifier);
7172
72- std::string prefix=id2string (function);
7373 if (!it->source_location ().get_property_class ().empty ())
7474 {
75- if (!prefix.empty ())
76- prefix+=" ." ;
75+ prefix += " ." ;
7776
7877 std::string class_infix =
7978 id2string (it->source_location ().get_property_class ());
@@ -84,8 +83,7 @@ void label_properties(
8483 prefix+=class_infix;
8584 }
8685
87- if (!prefix.empty ())
88- prefix+=" ." ;
86+ prefix += " ." ;
8987
9088 std::size_t &count=property_counters[prefix];
9189
Original file line number Diff line number Diff line change 1919
2020#include " goto_model.h"
2121
22- optionalt<source_locationt> find_property (
23- const irep_idt &property,
24- const goto_functionst & goto_functions)
22+ optionalt<std::pair<irep_idt, source_locationt>>
23+ find_property (const irep_idt &property, const goto_functionst &goto_functions)
2524{
2625 for (const auto &fct : goto_functions.function_map )
2726 {
@@ -33,7 +32,7 @@ optionalt<source_locationt> find_property(
3332 {
3433 if (ins.source_location ().get_property_id () == property)
3534 {
36- return ins.source_location ();
35+ return std::make_pair (fct. first , ins.source_location () );
3736 }
3837 }
3938 }
Original file line number Diff line number Diff line change @@ -45,11 +45,10 @@ void show_properties(
4545// / \param property: irep_idt that identifies property
4646// / \param goto_functions: program in which to search for
4747// / the property
48- // / \return optional<source_locationt> the location of the
48+ // / \return A pair of function identifier and source location of the
4949// / property, if found.
50- optionalt<source_locationt> find_property (
51- const irep_idt &property,
52- const goto_functionst &goto_functions);
50+ optionalt<std::pair<irep_idt, source_locationt>>
51+ find_property (const irep_idt &property, const goto_functionst &goto_functions);
5352
5453// / \brief Collects the properties in the goto program into a `json_arrayt`
5554// / \param json_properties: JSON array to hold the properties
Original file line number Diff line number Diff line change @@ -197,14 +197,13 @@ irep_idt SSA_stept::get_property_id() const
197197 else if (source.pc ->is_goto ())
198198 {
199199 // this is likely an unwinding assertion
200- property_id = id2string (source.pc -> source_location (). get_function ()) +
201- " .unwind. " + std::to_string (source.pc ->loop_number );
200+ property_id = id2string (source.function_id ) + " .unwind. " +
201+ std::to_string (source.pc ->loop_number );
202202 }
203203 else if (source.pc ->is_function_call ())
204204 {
205205 // this is likely a recursion unwinding assertion
206- property_id =
207- id2string (source.pc ->source_location ().get_function ()) + " .recursion" ;
206+ property_id = id2string (source.function_id ) + " .recursion" ;
208207 }
209208 else
210209 {
You can’t perform that action at this time.
0 commit comments