Skip to content

Commit 9c5d5e5

Browse files
Merge pull request #151 from FrNecas/frnecas-cbmc-5.11
Update to CBMC 5.11
2 parents 4e08c62 + d7ec9e3 commit 9c5d5e5

24 files changed

+187
-97
lines changed

lib/cbmc

Submodule cbmc updated 3472 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.15\] dereference failure: deallocated dynamic object in \*p: FAILURE
7+
\[main.pointer_dereference.17\] dereference failure: deallocated dynamic object in \*\(\(List\)\(char \*\)\(\(char \*\)p \+ \(signed long int\)8ul\)\): 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.33\] dereference failure: deallocated dynamic object in \*p: FAILURE
7+
\[main.pointer_dereference.38\] dereference failure: deallocated dynamic object in \*\(\(List\)\(char \*\)\(\(char \*\)p \+ \(signed long int\)8ul\)\): FAILURE

src/2ls/2ls_parse_options.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Author: Daniel Kroening, Peter Schrammel
3939
#include <goto-programs/remove_skip.h>
4040
#include <goto-programs/show_symbol_table.h>
4141
#include <goto-programs/initialize_goto_model.h>
42+
#include <goto-programs/show_goto_functions.h>
4243

4344
#include <analyses/goto_check.h>
4445

@@ -899,11 +900,11 @@ bool twols_parse_optionst::get_goto_program(
899900

900901
try
901902
{
902-
goto_model=initialize_goto_model(cmdline, ui_message_handler);
903+
goto_model=initialize_goto_model(cmdline.args, ui_message_handler, options);
903904

904905
if(cmdline.isset("show-symbol-table"))
905906
{
906-
show_symbol_table(goto_model, ui_message_handler.get_ui());
907+
show_symbol_table(goto_model.symbol_table, ui_message_handler);
907908
return true;
908909
}
909910

@@ -1140,8 +1141,11 @@ bool twols_parse_optionst::process_goto_program(
11401141
// show it?
11411142
if(cmdline.isset("show-goto-functions"))
11421143
{
1143-
const namespacet ns(goto_model.symbol_table);
1144-
goto_model.goto_functions.output(ns, std::cout);
1144+
show_goto_functions(
1145+
goto_model,
1146+
get_message_handler(),
1147+
ui_message_handler.get_ui(),
1148+
false);
11451149
return true;
11461150
}
11471151
}
@@ -1282,7 +1286,7 @@ void twols_parse_optionst::show_counterexample(
12821286
{
12831287
case ui_message_handlert::uit::PLAIN:
12841288
std::cout << std::endl << "Counterexample:" << std::endl;
1285-
show_goto_trace(std::cout, ns, error_trace);
1289+
show_goto_trace(result(), ns, error_trace);
12861290
break;
12871291

12881292
case ui_message_handlert::uit::XML_UI:

src/2ls/horn_encoding.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void horn_encodingt::translate(
6565
";\n";
6666

6767
// compute SSA
68-
local_SSAt local_SSA(f_it->second, symbol_table, options, "");
68+
local_SSAt local_SSA(f_it->first, f_it->second, symbol_table, options, "");
6969

7070
const goto_programt &body=f_it->second.body;
7171

src/2ls/preprocessing_util.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void twols_parse_optionst::propagate_constants(goto_modelt &goto_model)
5959
namespacet ns(goto_model.symbol_table);
6060
Forall_goto_functions(f_it, goto_model.goto_functions)
6161
{
62-
constant_propagator_ait(f_it->second, ns);
62+
constant_propagator_ait(f_it->first, f_it->second, ns);
6363
}
6464
}
6565

@@ -627,9 +627,9 @@ std::map<symbol_exprt, size_t> twols_parse_optionst::split_dynamic_objects(
627627
if(!f_it->second.body_available())
628628
continue;
629629
namespacet ns(goto_model.symbol_table);
630-
ssa_value_ait value_analysis(f_it->second, ns, options);
630+
ssa_value_ait value_analysis(f_it->first, f_it->second, ns, options);
631631
dynobj_instance_analysist do_inst(
632-
f_it->second, ns, options, value_analysis);
632+
f_it->first, f_it->second, ns, options, value_analysis);
633633

634634
compute_dynobj_instances(
635635
f_it->second.body, do_inst, dynobj_instances, ns);

src/2ls/show.cpp

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ Author: Daniel Kroening, [email protected]
2929
#include "show.h"
3030

3131
void show_assignments(
32+
const irep_idt &function_identifier,
3233
const goto_functionst::goto_functiont &goto_function,
3334
const namespacet &ns,
3435
const optionst &options,
3536
std::ostream &out)
3637
{
3738
ssa_objectst ssa_objects(goto_function, ns);
38-
ssa_value_ait ssa_value_ai(goto_function, ns, options);
39+
ssa_value_ait ssa_value_ai(function_identifier, goto_function, ns, options);
3940
assignmentst assignments(
4041
goto_function.body,
4142
ns,
@@ -61,37 +62,38 @@ void show_assignments(
6162
if(f_it==goto_model.goto_functions.function_map.end())
6263
out << "function " << function << " not found\n";
6364
else
64-
show_assignments(f_it->second, ns, options, out);
65+
show_assignments(f_it->first, f_it->second, ns, options, out);
6566
}
6667
else
6768
{
6869
forall_goto_functions(f_it, goto_model.goto_functions)
6970
{
7071
out << ">>>> Function " << f_it->first << "\n";
7172

72-
show_assignments(f_it->second, ns, options, out);
73+
show_assignments(f_it->first, f_it->second, ns, options, out);
7374

7475
out << "\n";
7576
}
7677
}
7778
}
7879

7980
void show_defs(
81+
const irep_idt &function_identifier,
8082
const goto_functionst::goto_functiont &goto_function,
8183
const namespacet &ns,
8284
const optionst &options,
8385
std::ostream &out)
8486
{
8587
ssa_objectst ssa_objects(goto_function, ns);
86-
ssa_value_ait ssa_value_ai(goto_function, ns, options);
88+
ssa_value_ait ssa_value_ai(function_identifier, goto_function, ns, options);
8789
assignmentst assignments(
8890
goto_function.body,
8991
ns,
9092
options,
9193
ssa_objects,
9294
ssa_value_ai);
9395
ssa_ait ssa_analysis(assignments);
94-
ssa_analysis(goto_function, ns);
96+
ssa_analysis(function_identifier, goto_function, ns);
9597
ssa_analysis.output(ns, goto_function.body, out);
9698
}
9799

@@ -111,15 +113,15 @@ void show_defs(
111113
if(f_it==goto_model.goto_functions.function_map.end())
112114
out << "function " << function << " not found\n";
113115
else
114-
show_defs(f_it->second, ns, options, out);
116+
show_defs(f_it->first, f_it->second, ns, options, out);
115117
}
116118
else
117119
{
118120
forall_goto_functions(f_it, goto_model.goto_functions)
119121
{
120122
out << ">>>> Function " << f_it->first << "\n";
121123

122-
show_defs(f_it->second, ns, options, out);
124+
show_defs(f_it->first, f_it->second, ns, options, out);
123125

124126
out << "\n";
125127
}
@@ -166,6 +168,7 @@ void show_guards(
166168
}
167169

168170
void show_ssa(
171+
const irep_idt &function_identifier,
169172
const goto_functionst::goto_functiont &goto_function,
170173
bool simplify,
171174
const symbol_tablet &symbol_table,
@@ -175,7 +178,11 @@ void show_ssa(
175178
if(!goto_function.body_available())
176179
return;
177180

178-
unwindable_local_SSAt local_SSA(goto_function, symbol_table, options);
181+
unwindable_local_SSAt local_SSA(
182+
function_identifier,
183+
goto_function,
184+
symbol_table,
185+
options);
179186
if(simplify)
180187
::simplify(local_SSA, local_SSA.ns);
181188
local_SSA.output_verbose(out);
@@ -197,7 +204,13 @@ void show_ssa(
197204
if(f_it==goto_model.goto_functions.function_map.end())
198205
out << "function " << function << " not found\n";
199206
else
200-
show_ssa(f_it->second, simplify, goto_model.symbol_table, options, out);
207+
show_ssa(
208+
f_it->first,
209+
f_it->second,
210+
simplify,
211+
goto_model.symbol_table,
212+
options,
213+
out);
201214
}
202215
else
203216
{
@@ -210,7 +223,13 @@ void show_ssa(
210223

211224
out << ">>>> Function " << f_it->first << "\n";
212225

213-
show_ssa(f_it->second, simplify, goto_model.symbol_table, options, out);
226+
show_ssa(
227+
f_it->first,
228+
f_it->second,
229+
simplify,
230+
goto_model.symbol_table,
231+
options,
232+
out);
214233

215234
out << "\n";
216235
}
@@ -383,13 +402,14 @@ void show_ssa_symbols(
383402
}
384403

385404
void show_value_set(
405+
const irep_idt &function_identifier,
386406
const goto_functionst::goto_functiont &goto_function,
387407
const namespacet &ns,
388408
const optionst &options,
389409
std::ostream &out)
390410
{
391411
ssa_objectst ssa_objects(goto_function, ns);
392-
ssa_value_ait ssa_value_ai(goto_function, ns, options);
412+
ssa_value_ait ssa_value_ai(function_identifier, goto_function, ns, options);
393413
ssa_value_ai.output(ns, goto_function, out);
394414
}
395415

@@ -409,15 +429,15 @@ void show_value_sets(
409429
if(f_it==goto_model.goto_functions.function_map.end())
410430
out << "function " << function << " not found\n";
411431
else
412-
show_value_set(f_it->second, ns, options, out);
432+
show_value_set(f_it->first, f_it->second, ns, options, out);
413433
}
414434
else
415435
{
416436
forall_goto_functions(f_it, goto_model.goto_functions)
417437
{
418438
out << ">>>> Function " << f_it->first << "\n";
419439

420-
show_value_set(f_it->second, ns, options, out);
440+
show_value_set(f_it->first, f_it->second, ns, options, out);
421441

422442
out << "\n";
423443
}

src/2ls/summary_checker_base.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Author: Peter Schrammel
1616
#include <langapi/language_util.h>
1717
#include <util/prefix.h>
1818
#include <goto-programs/write_goto_binary.h>
19+
#include <goto-programs/show_goto_functions.h>
1920

2021
#include <solvers/sat/satcheck.h>
2122
#include <solvers/flattening/bv_pointers.h>
@@ -501,7 +502,11 @@ void summary_checker_baset::instrument_and_output(
501502
instrument_gotot instrument_goto(options, ssa_db, summary_db);
502503
instrument_goto(goto_model);
503504
if(verbosity==10)
504-
goto_model.output(std::cout);
505+
show_goto_functions(
506+
goto_model,
507+
get_message_handler(),
508+
ui_message_handlert::uit::PLAIN,
509+
false);
505510
std::string filename=options.get_option("instrument-output");
506511
status() << "Writing instrumented goto-binary " << filename << eom;
507512
write_goto_binary(

src/2ls/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ Author: Peter Schrammel
1212
#ifndef CPROVER_2LS_2LS_VERSION_H
1313
#define CPROVER_2LS_2LS_VERSION_H
1414

15-
#define TWOLS_VERSION "0.9.4"
15+
#define TWOLS_VERSION "0.9.5"
1616

1717
#endif

src/ssa/dynobj_instance_analysis.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ void dynobj_instance_domaint::rhs_concretisation(
119119
}
120120

121121
void dynobj_instance_domaint::transform(
122+
const irep_idt &function_from,
122123
ai_domain_baset::locationt from,
124+
const irep_idt &function_to,
123125
ai_domain_baset::locationt to,
124126
ai_baset &ai,
125127
const namespacet &ns)

src/ssa/dynobj_instance_analysis.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ class dynobj_instance_domaint:public ai_domain_baset
151151
std::map<symbol_exprt, std::set<exprt>> live_pointers;
152152

153153
void transform(
154+
const irep_idt &,
154155
locationt from,
156+
const irep_idt &,
155157
locationt to,
156158
ai_baset &ai,
157159
const namespacet &ns) override;
@@ -208,14 +210,15 @@ class dynobj_instance_analysist:public ait<dynobj_instance_domaint>
208210
{
209211
public:
210212
dynobj_instance_analysist(
213+
const irep_idt &function_identifier,
211214
const goto_functionst::goto_functiont &goto_function,
212215
const namespacet &ns,
213216
const optionst &_options,
214217
ssa_value_ait &_value_ai):
215218
options(_options),
216219
value_analysis(_value_ai)
217220
{
218-
operator()(goto_function, ns);
221+
operator()(function_identifier, goto_function, ns);
219222
}
220223

221224
protected:

src/ssa/local_ssa.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Author: Daniel Kroening, [email protected]
3030
void local_SSAt::build_SSA()
3131
{
3232
// perform SSA data-flow analysis
33-
ssa_analysis(goto_function, ns);
33+
ssa_analysis(function_identifier, goto_function, ns);
3434

3535
forall_goto_program_instructions(i_it, goto_function.body)
3636
{
@@ -414,10 +414,10 @@ void local_SSAt::build_function_call(locationt loc)
414414
}
415415

416416
// turn function call into expression
417-
function_application_exprt f;
418-
f.function()=to_symbol_expr(code_function_call.function());
419-
f.type()=code_function_call.lhs().type();
420-
f.arguments()=code_function_call.arguments();
417+
function_application_exprt f(
418+
to_symbol_expr(code_function_call.function()),
419+
code_function_call.arguments(),
420+
code_function_call.lhs().type());
421421

422422
// access to "new" value in template declarations
423423
if(code_function_call.function().id()==ID_symbol &&

src/ssa/local_ssa.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,23 @@ class local_SSAt
3737
typedef goto_programt::const_targett locationt;
3838

3939
inline local_SSAt(
40+
const irep_idt &_function_identifier,
4041
const goto_functiont &_goto_function,
4142
const symbol_tablet &_symbol_table,
4243
const optionst &_options,
4344
const std::string &_suffix=""):
4445
ns(_symbol_table), goto_function(_goto_function), options(_options),
4546
ssa_objects(_goto_function, ns),
46-
ssa_value_ai(_goto_function, ns, options),
47+
ssa_value_ai(_function_identifier, _goto_function, ns, options),
4748
assignments(
4849
_goto_function.body,
4950
ns,
5051
options,
5152
ssa_objects,
5253
ssa_value_ai),
53-
alias_analysis(_goto_function, ns),
54+
alias_analysis(_function_identifier, _goto_function, ns),
5455
guard_map(_goto_function.body),
56+
function_identifier(_function_identifier),
5557
ssa_analysis(assignments),
5658
suffix(_suffix)
5759
{
@@ -242,6 +244,7 @@ class local_SSAt
242244
// protected:
243245
guard_mapt guard_map;
244246

247+
const irep_idt &function_identifier;
245248
ssa_ait ssa_analysis;
246249
std::string suffix; // an extra suffix
247250

0 commit comments

Comments
 (0)