Skip to content

Commit b1877c2

Browse files
committed
Update to CBMC 5.12
Fix decision_procedure include Update satcheckt solver creation Update initialize method arguments Workaround missing function id in goto instruction Workaround changes to symbol_exprt constructor Convert to_integer argument to const expression Fix obtaining of entry state Get rid of deprecated nil_typet Fix index_exprt initialization Replace deprecated symbol_typet Replace get_unsigned_int with get_size_t Replace deprecated is_procedure_local Fix construction of byte_extract_exprt Replace deprecated integer2ulong Replace deprecated make_typecast Replace deprecated find_symbols call Fix langapi include Fix xml_expr include Remove unused replace method Add constructor without arguments to row_valuet Do not try to create symbol_exprt with 0 arguments Refactor find_corresponding_symbol to return optionalt to achieve this Workaround missing default constructor for symbol_exprt Workaround missing default constant_exprt constructor in preadbs_domain Correctly include integer_typet Replace deprecated integer2unsigned Fix get_loophead_selects prototype Workaround removed property_checkert Fix show_goto_functions call Fix show_properties call Fix show_defs ssa_analysis output Fix side_effect_expr_nondett construction Fix goto unwinding Link with goto-checker Initialize values to bottom Pass message_handler to incremental_solver Initialize states of analyses to bottom Use NOT_CHECKED when checking status Simplify incremental solver using CBMC's push and pop Make solvers less verbose unless debugging Do not add __CPROVER variables to counterexample Avoid the use of is_backwards_goto while unwinding - The method may in some cases (e.g. ite4 termination regression test) cause a segfault for unknown reasons. Flip the condition, check using incoming edges if an instruction is loop head rather than checking if a goto is loop exit. Initialize properties with UNKNOWN - This is better for backwards compatibility for now, since we have no way of checking if a property was checked or we simply could not check it. However this is a potential place for improvements. Initialize constant propagator states Update expected assert description - CBMC 5.12 changed the assertion description of fields of structures to be more user-friendly (the field is named instead of an offset added). Signed-off-by: František Nečas <[email protected]>
1 parent 9c5d5e5 commit b1877c2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+509
-460
lines changed

lib/cbmc

Submodule cbmc updated 5543 files

regression/memsafety/built_from_end_false/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ main.c
44
^EXIT=10$
55
^SIGNAL=0$
66
^VERIFICATION FAILED$
7-
\[main.pointer_dereference.17\] dereference failure: deallocated dynamic object in \*\(\(List\)\(char \*\)\(\(char \*\)p \+ \(signed long int\)8ul\)\): FAILURE
7+
\[main.pointer_dereference.17\] dereference failure: deallocated dynamic object in p->n: FAILURE

regression/memsafety/simple_false/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ main.c
44
^EXIT=10$
55
^SIGNAL=0$
66
^VERIFICATION FAILED$
7-
\[main.pointer_dereference.38\] dereference failure: deallocated dynamic object in \*\(\(List\)\(char \*\)\(\(char \*\)p \+ \(signed long int\)8ul\)\): FAILURE
7+
\[main.pointer_dereference.38\] dereference failure: deallocated dynamic object in p->n: FAILURE

src/2ls/2ls_parse_options.cpp

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Author: Daniel Kroening, Peter Schrammel
6969
#define FILTER_ASSERTIONS 1
7070

7171
twols_parse_optionst::twols_parse_optionst(int argc, const char **argv):
72-
parse_options_baset(TWOLS_OPTIONS, argc, argv),
72+
parse_options_baset(TWOLS_OPTIONS, argc, argv, "2LS " TWOLS_VERSION),
7373
messaget(ui_message_handler),
7474
ui_message_handler(cmdline, "2LS " TWOLS_VERSION),
7575
recursion_detected(false),
@@ -630,34 +630,43 @@ int twols_parse_optionst::doit()
630630
// do actual analysis
631631
switch((*checker)(goto_model))
632632
{
633-
case property_checkert::resultt::PASS:
633+
case resultt::PASS:
634634
if(report_assertions)
635-
report_properties(options, goto_model, checker->property_map);
635+
report_properties(
636+
options,
637+
goto_model,
638+
checker->property_map,
639+
checker->traces);
636640
report_success();
637641
if(cmdline.isset("graphml-witness"))
638642
output_graphml_proof(options, goto_model, *checker);
639643
retval=0;
640644
break;
641645

642-
case property_checkert::resultt::FAIL:
646+
case resultt::FAIL:
643647
{
644648
if(report_assertions)
645-
report_properties(options, goto_model, checker->property_map);
649+
report_properties(
650+
options,
651+
goto_model,
652+
checker->property_map,
653+
checker->traces);
646654

647655
// validate trace
648656
bool trace_valid=false;
649657
for(const auto &p : checker->property_map)
650658
{
651-
if(p.second.result!=property_checkert::resultt::FAIL)
659+
if(p.second.status!=property_statust::FAIL)
652660
continue;
653661

662+
goto_tracet trace=checker->traces[p.first];
654663
if(options.get_bool_option("trace"))
655-
show_counterexample(goto_model, p.second.error_trace);
664+
show_counterexample(goto_model, trace);
656665

657666
trace_valid=
658-
!p.second.error_trace.steps.empty() &&
667+
!trace.steps.empty() &&
659668
(options.get_bool_option("nontermination") ||
660-
p.second.error_trace.steps.back().is_assert());
669+
trace.steps.back().is_assert());
661670
break;
662671
}
663672

@@ -678,9 +687,13 @@ int twols_parse_optionst::doit()
678687
retval=10;
679688
break;
680689
}
681-
case property_checkert::resultt::UNKNOWN:
690+
case resultt::UNKNOWN:
682691
if(report_assertions)
683-
report_properties(options, goto_model, checker->property_map);
692+
report_properties(
693+
options,
694+
goto_model,
695+
checker->property_map,
696+
checker->traces);
684697
retval=5;
685698
report_unknown();
686699
break;
@@ -693,6 +706,7 @@ int twols_parse_optionst::doit()
693706
{
694707
checker->instrument_and_output(
695708
goto_model,
709+
ui_message_handler,
696710
ui_message_handler.get_verbosity());
697711
}
698712

@@ -1128,10 +1142,7 @@ bool twols_parse_optionst::process_goto_program(
11281142

11291143
if(cmdline.isset("show-properties"))
11301144
{
1131-
show_properties(
1132-
goto_model,
1133-
get_message_handler(),
1134-
ui_message_handler.get_ui());
1145+
show_properties(goto_model, ui_message_handler);
11351146
return true;
11361147
}
11371148

@@ -1143,8 +1154,7 @@ bool twols_parse_optionst::process_goto_program(
11431154
{
11441155
show_goto_functions(
11451156
goto_model,
1146-
get_message_handler(),
1147-
ui_message_handler.get_ui(),
1157+
ui_message_handler,
11481158
false);
11491159
return true;
11501160
}
@@ -1179,9 +1189,10 @@ bool twols_parse_optionst::process_goto_program(
11791189
void twols_parse_optionst::report_properties(
11801190
const optionst &options,
11811191
const goto_modelt &goto_model,
1182-
const property_checkert::property_mapt &property_map)
1192+
const propertiest &property_map,
1193+
const tracest &traces)
11831194
{
1184-
for(property_checkert::property_mapt::const_iterator
1195+
for(propertiest::const_iterator
11851196
it=property_map.begin();
11861197
it!=property_map.end();
11871198
it++)
@@ -1193,7 +1204,7 @@ void twols_parse_optionst::report_properties(
11931204
#endif
11941205

11951206
if(!options.get_bool_option("all-properties") &&
1196-
it->second.result!=property_checkert::resultt::FAIL)
1207+
it->second.status!=property_statust::FAIL)
11971208
continue;
11981209

11991210
if(ui_message_handler.get_ui()==ui_message_handlert::uit::XML_UI)
@@ -1202,27 +1213,27 @@ void twols_parse_optionst::report_properties(
12021213
xml_result.set_attribute("property", id2string(it->first));
12031214
xml_result.set_attribute(
12041215
"status",
1205-
property_checkert::as_string(it->second.result));
1216+
as_string(it->second.status));
12061217
std::cout << xml_result << "\n";
12071218
}
12081219
else
12091220
{
12101221
status() << "[" << it->first << "] "
1211-
<< it->second.location->source_location.get_comment()
1222+
<< it->second.pc->source_location.get_comment()
12121223
<< ": "
1213-
<< property_checkert::as_string(it->second.result)
1224+
<< as_string(it->second.status)
12141225
<< eom;
12151226
}
12161227

12171228
if(options.get_bool_option("trace") &&
1218-
it->second.result==property_checkert::resultt::FAIL)
1219-
show_counterexample(goto_model, it->second.error_trace);
1229+
it->second.status==property_statust::FAIL)
1230+
show_counterexample(goto_model, traces.at(it->first));
12201231
if(cmdline.isset("json-cex") &&
1221-
it->second.result==property_checkert::resultt::FAIL)
1232+
it->second.status==property_statust::FAIL)
12221233
output_json_cex(
12231234
options,
12241235
goto_model,
1225-
it->second.error_trace,
1236+
traces.at(it->first),
12261237
id2string(it->first));
12271238
}
12281239

@@ -1233,14 +1244,15 @@ void twols_parse_optionst::report_properties(
12331244
unsigned failed=0;
12341245
unsigned unknown=0;
12351246

1236-
for(property_checkert::property_mapt::const_iterator
1247+
for(propertiest::const_iterator
12371248
it=property_map.begin();
12381249
it!=property_map.end();
12391250
it++)
12401251
{
1241-
if(it->second.result==property_checkert::resultt::UNKNOWN)
1252+
if(it->second.status==property_statust::UNKNOWN ||
1253+
it->second.status==property_statust::NOT_CHECKED)
12421254
unknown++;
1243-
if(it->second.result==property_checkert::resultt::FAIL)
1255+
if(it->second.status==property_statust::FAIL)
12441256
failed++;
12451257
}
12461258

@@ -1309,15 +1321,15 @@ void twols_parse_optionst::output_graphml_cex(
13091321
{
13101322
for(const auto &p : summary_checker.property_map)
13111323
{
1312-
if(p.second.result!=property_checkert::resultt::FAIL)
1324+
if(p.second.status!=property_statust::FAIL)
13131325
continue;
13141326

13151327
const namespacet ns(goto_model.symbol_table);
13161328
const std::string graphml=options.get_option("graphml-witness");
13171329
if(!graphml.empty())
13181330
{
13191331
graphml_witnesst graphml_witness(ns);
1320-
graphml_witness(p.second.error_trace);
1332+
graphml_witness(summary_checker.traces.at(p.first));
13211333

13221334
if(graphml=="-")
13231335
write_graphml(graphml_witness.graph(), std::cout);

src/2ls/2ls_parse_options.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ Author: Daniel Kroening, Peter Schrammel
1616
#include <util/parse_options.h>
1717
#include <util/replace_symbol.h>
1818

19-
#include <langapi/language_ui.h>
20-
2119
#include <analyses/goto_check.h>
2220
#include <ssa/dynobj_instance_analysis.h>
2321

@@ -104,7 +102,8 @@ class twols_parse_optionst:
104102
void report_properties(
105103
const optionst &options,
106104
const goto_modelt &,
107-
const summary_checker_baset::property_mapt &);
105+
const propertiest &,
106+
const tracest &traces);
108107

109108
void show_counterexample(
110109
const goto_modelt &,

src/2ls/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ OBJ+= $(CPROVER_DIR)/src/ansi-c/ansi-c$(LIBEXT) \
2727
$(CPROVER_DIR)/src/util/util$(LIBEXT) \
2828
$(CPROVER_DIR)/src/goto-instrument/unwind$(OBJEXT) \
2929
$(CPROVER_DIR)/src/goto-instrument/unwindset$(OBJEXT) \
30+
$(CPROVER_DIR)/src/goto-checker/goto-checker$(LIBEXT) \
3031
../domains/domains$(LIBEXT) \
3132
../ssa/ssa$(LIBEXT) \
3233
../solver/solver$(LIBEXT) \

src/2ls/cover_goals_ext.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,15 @@ void cover_goals_extt::assignment()
130130
for(goal_mapt::const_iterator it=goal_map.begin();
131131
it!=goal_map.end(); it++, g_it++)
132132
{
133-
if(property_map[it->first].result==property_checkert::resultt::UNKNOWN &&
133+
if((property_map.at(it->first).status==property_statust::UNKNOWN ||
134+
property_map.at(it->first).status==property_statust::NOT_CHECKED) &&
134135
solver.l_get(g_it->condition).is_true())
135136
{
136-
property_map[it->first].result=property_checkert::resultt::FAIL;
137+
property_map.at(it->first).status=property_statust::FAIL;
137138
if(build_error_trace)
138139
{
139140
ssa_build_goto_tracet build_goto_trace(SSA, solver.get_solver());
140-
build_goto_trace(property_map[it->first].error_trace);
141+
build_goto_trace(traces[it->first]);
141142
if(!all_properties)
142143
break;
143144
}
@@ -159,14 +160,15 @@ void cover_goals_extt::assignment()
159160
for(goal_mapt::const_iterator it=goal_map.begin();
160161
it!=goal_map.end(); it++, g_it++)
161162
{
162-
if(property_map[it->first].result==property_checkert::resultt::UNKNOWN &&
163+
if((property_map.at(it->first).status==property_statust::UNKNOWN ||
164+
property_map.at(it->first).status==property_statust::NOT_CHECKED) &&
163165
solver.l_get(g_it->condition).is_true())
164166
{
165-
property_map[it->first].result=property_checkert::resultt::FAIL;
167+
property_map.at(it->first).status=property_statust::FAIL;
166168
if(build_error_trace)
167169
{
168170
ssa_build_goto_tracet build_goto_trace(SSA, solver.get_solver());
169-
build_goto_trace(property_map[it->first].error_trace);
171+
build_goto_trace(traces[it->first]);
170172

171173
#if 0
172174
show_raw_countermodel(

src/2ls/cover_goals_ext.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ Author: Daniel Kroening, [email protected]
1313
#define CPROVER_2LS_2LS_COVER_GOALS_EXT_H
1414

1515
#include <util/message.h>
16-
#include <goto-programs/property_checker.h>
16+
#include <goto-checker/properties.h>
1717

1818
#include "../ssa/local_ssa.h"
1919
#include "../ssa/unwindable_local_ssa.h"
2020
#include "../domains/incremental_solver.h"
21+
#include "traces.h"
2122

2223
/// Try to cover some given set of goals incrementally. This can be seen as a
2324
/// heuristic variant of SAT-based set-cover. No minimality guarantee.
@@ -46,13 +47,15 @@ class cover_goals_extt:public messaget
4647
unwindable_local_SSAt &_SSA,
4748
incremental_solvert &_solver,
4849
const exprt::operandst& _loophead_selects,
49-
property_checkert::property_mapt &_property_map,
50+
propertiest &_property_map,
51+
tracest &_traces,
5052
bool _spurious_check,
5153
bool _all_properties,
5254
bool _build_error_trace):
5355
SSA(_SSA),
5456
solver(_solver),
5557
property_map(_property_map),
58+
traces(_traces),
5659
spurious_check(_spurious_check),
5760
all_properties(_all_properties),
5861
build_error_trace(_build_error_trace),
@@ -111,7 +114,8 @@ class cover_goals_extt:public messaget
111114
unwindable_local_SSAt &SSA;
112115
unsigned _number_covered, _iterations;
113116
incremental_solvert &solver;
114-
property_checkert::property_mapt &property_map;
117+
propertiest &property_map;
118+
tracest &traces;
115119
bool spurious_check, all_properties, build_error_trace;
116120
exprt::operandst loophead_selects;
117121

src/2ls/graphml_witness_ext.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void graphml_witness_extt::operator()(
5757
continue;
5858
}
5959

60-
const graphmlt::node_indext node=add_node(cfg[i]);
60+
const graphmlt::node_indext node=add_node(cfg[i], function_name);
6161
index_map[i]=node;
6262
}
6363
for(std::size_t i=0; i<cfg.size(); ++i)
@@ -71,7 +71,8 @@ void graphml_witness_extt::operator()(
7171
}
7272

7373
graphmlt::node_indext graphml_witness_extt::add_node(
74-
const dynamic_cfg_nodet &cfg_node)
74+
const dynamic_cfg_nodet &cfg_node,
75+
const irep_idt &function_identifier)
7576
{
7677
const graphmlt::node_indext node=graphml.add_node();
7778
graphml[node].node_name=cfg_node.id.to_string();
@@ -81,7 +82,7 @@ graphmlt::node_indext graphml_witness_extt::add_node(
8182
std::ostringstream invs;
8283
invs << from_expr(ns, "", cfg_node.assumption);
8384
graphml[node].invariant=invs.str();
84-
graphml[node].invariant_scope=id2string(cfg_node.id.pc->function);
85+
graphml[node].invariant_scope=id2string(function_identifier);
8586
}
8687
return node;
8788
}

src/2ls/graphml_witness_ext.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,15 @@ class graphml_witness_extt:public graphml_witnesst
3030
void operator()(const summary_checker_baset &summary_checker);
3131

3232
protected:
33-
graphmlt::node_indext add_node(
34-
std::map<unsigned,
35-
unsigned> &loc_to_node,
36-
goto_programt::const_targett it);
37-
3833
void add_edge(
3934
const graphmlt::node_indext &from,
4035
const dynamic_cfg_nodet &from_cfg_node,
4136
const graphmlt::node_indext &to,
4237
const dynamic_cfg_nodet &to_cfg_node);
4338

4439
graphmlt::node_indext add_node(
45-
const dynamic_cfg_nodet &cfg_node);
40+
const dynamic_cfg_nodet &cfg_node,
41+
const irep_idt &function_identifier);
4642
};
4743

4844
#endif // CPROVER_2LS_SUMMARIZER_GRAPHML_WITNESS_EXT_H

0 commit comments

Comments
 (0)