Skip to content

Commit 78f208c

Browse files
committed
Merge branch 'develop' into doc_8428
2 parents c974324 + f0543bd commit 78f208c

33 files changed

+282
-182
lines changed

Diff for: CHANGELOG

+25
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
# CBMC 6.2.0
2+
3+
## What's Changed
4+
* Dynamic frames: do not add trivial properties by @tautschnig in https://github.com/diffblue/cbmc/pull/8413
5+
6+
## Bug Fixes
7+
* Contracts/dynamic frames: do not attempt to instrument typedefs by @tautschnig in https://github.com/diffblue/cbmc/pull/8403
8+
* Remove dynamic_cast from bv_dimacst by @tautschnig in https://github.com/diffblue/cbmc/pull/8406
9+
* Remove uses of `dynamic_cast` from qualifierst hierarchy by @tautschnig in https://github.com/diffblue/cbmc/pull/8405
10+
* Remove Java's unnecessary languaget::parse peculiarity by @tautschnig in https://github.com/diffblue/cbmc/pull/8407
11+
* Solver factory: set_decision_procedure_time_limit does not require dynamic_cast by @tautschnig in https://github.com/diffblue/cbmc/pull/8409
12+
* Solver factory: make_satcheck_prop does not require dynamic_cast by @tautschnig in https://github.com/diffblue/cbmc/pull/8410
13+
* Solver factory: all solvers are stack_decision_proceduret by @tautschnig in https://github.com/diffblue/cbmc/pull/8408
14+
* Remove qualifierst by @tautschnig in https://github.com/diffblue/cbmc/pull/8419
15+
* Contracts (DFCC) regression tests: use CaDiCaL by @tautschnig in https://github.com/diffblue/cbmc/pull/8414
16+
* Library functions: mark them as compiled by @tautschnig in https://github.com/diffblue/cbmc/pull/8412
17+
* Maintain loop invariant annotation when converting do .. while by @tautschnig in https://github.com/diffblue/cbmc/pull/8417
18+
* CONTRACTS: redirect checks to outer write set for loops that get skipped by @remi-delmas-3000 in https://github.com/diffblue/cbmc/pull/8416
19+
* CONTRACTS: fix do while latch by @remi-delmas-3000 in https://github.com/diffblue/cbmc/pull/8420
20+
* Remove dynamic_cast from counterexample beautification code path by @tautschnig in https://github.com/diffblue/cbmc/pull/8421
21+
* Include <cstdint> for int64_t by @ismaell in https://github.com/diffblue/cbmc/pull/8426
22+
* SMT2 back-end: fix inconsistent array flattening by @tautschnig in https://github.com/diffblue/cbmc/pull/8400
23+
24+
**Full Changelog**: https://github.com/diffblue/cbmc/compare/cbmc-6.1.1...cbmc-6.2.0
25+
126
# CBMC 6.1.1
227

328
## What's Changed

Diff for: doc/doxygen-root/doxygen-markdown/doxygen-markdown-preprocessor.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ def parse_arguments():
5353

5454

5555
def pandoc(path, pandoc_write, pandoc_wrap, pandoc_filter=None):
56-
args = {
57-
'--write': pandoc_write,
58-
'--wrap': pandoc_wrap
59-
}
56+
args = [
57+
'--write', pandoc_write,
58+
'--wrap', pandoc_wrap
59+
]
6060
if pandoc_filter:
61-
args['--filter'] = Path(pandoc_filter).resolve()
61+
args.extend(['--filter', Path(pandoc_filter).resolve()])
6262

6363

64-
lines = subprocess.run(['pandoc', **args, path],
64+
lines = subprocess.run(['pandoc', *args, path],
6565
check=True,
6666
text=True,
6767
capture_output=True).stdout.splitlines()

Diff for: jbmc/regression/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set(test_pl_path "${CBMC_SOURCE_DIR}/../regression/test.pl")
1+
set(test_pl_path "${CBMC_SOURCE_DIR}/regression/test.pl")
22

33
# For the best possible utilisation of multiple cores when
44
# running tests in parallel, it is important that these directories are

Diff for: jbmc/src/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ macro(generic_includes name)
77
${JBMC_BINARY_DIR}
88
${JBMC_SOURCE_DIR}
99
${CBMC_BINARY_DIR}
10-
${CBMC_SOURCE_DIR}
10+
${CBMC_SOURCE_DIR}/src
1111
${CMAKE_CURRENT_BINARY_DIR}
1212
${CMAKE_CURRENT_SOURCE_DIR}
1313
${CUDD_INCLUDE}

Diff for: jbmc/src/janalyzer/janalyzer_parse_options.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,13 @@ int janalyzer_parse_optionst::doit()
401401
log.status() << "Generating GOTO Program" << messaget::eom;
402402
lazy_goto_model.load_all_functions();
403403

404-
std::unique_ptr<abstract_goto_modelt> goto_model_ptr =
404+
std::unique_ptr<goto_modelt> goto_model_ptr =
405405
lazy_goto_modelt::process_whole_model_and_freeze(
406406
std::move(lazy_goto_model));
407407
if(goto_model_ptr == nullptr)
408408
return CPROVER_EXIT_INTERNAL_ERROR;
409409

410-
goto_modelt &goto_model = dynamic_cast<goto_modelt &>(*goto_model_ptr);
410+
goto_modelt &goto_model = *goto_model_ptr;
411411

412412
// show it?
413413
if(cmdline.isset("show-symbol-table"))

Diff for: jbmc/src/jbmc/jbmc_parse_options.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -628,12 +628,16 @@ int jbmc_parse_optionst::get_goto_program(
628628

629629
// Move the model out of the local lazy_goto_model
630630
// and into the caller's goto_model
631-
goto_model_ptr = lazy_goto_modelt::process_whole_model_and_freeze(
632-
std::move(lazy_goto_model));
633-
if(goto_model_ptr == nullptr)
631+
auto final_goto_model_ptr =
632+
lazy_goto_modelt::process_whole_model_and_freeze(
633+
std::move(lazy_goto_model));
634+
if(final_goto_model_ptr == nullptr)
634635
return CPROVER_EXIT_INTERNAL_ERROR;
635636

636-
goto_modelt &goto_model = dynamic_cast<goto_modelt &>(*goto_model_ptr);
637+
goto_modelt &goto_model = *final_goto_model_ptr;
638+
goto_model_ptr =
639+
std::unique_ptr<abstract_goto_modelt>(final_goto_model_ptr.get());
640+
final_goto_model_ptr.release();
637641

638642
if(cmdline.isset("validate-goto-model"))
639643
{

Diff for: jbmc/unit/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
file(GLOB_RECURSE sources "*.cpp" "*.h")
2-
list(APPEND sources ${CBMC_SOURCE_DIR}/../unit/unit_tests.cpp)
2+
list(APPEND sources ${CBMC_SOURCE_DIR}/unit/unit_tests.cpp)
33

44
file(GLOB_RECURSE java-testing_utils "java-testing-utils/*.cpp" "java-testing-utils/*.h")
55

@@ -14,8 +14,8 @@ add_executable(java-unit ${sources})
1414
target_include_directories(java-unit
1515
PUBLIC
1616
${CBMC_BINARY_DIR}
17-
${CBMC_SOURCE_DIR}
18-
${CBMC_SOURCE_DIR}/../unit
17+
${CBMC_SOURCE_DIR}/src
18+
${CBMC_SOURCE_DIR}/unit
1919
${CMAKE_CURRENT_SOURCE_DIR}
2020
)
2121
target_link_libraries(java-unit

Diff for: jbmc/unit/java-testing-utils/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ target_link_libraries(java-testing-utils
77
target_include_directories(java-testing-utils
88
PUBLIC
99
${CMAKE_CURRENT_SOURCE_DIR}/..
10-
${CBMC_SOURCE_DIR}/../unit
10+
${CBMC_SOURCE_DIR}/unit
1111
)

Diff for: regression/ansi-c/goto_convert_assert/main.c

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
void __assert_fail(char *, char *, unsigned, char *);
2+
3+
int main()
4+
{
5+
(void)((1 < 2) || (__CPROVER_assert(0, ""), 0));
6+
7+
int jumpguard;
8+
jumpguard = (jumpguard | 1);
9+
label_1:;
10+
{
11+
while(1)
12+
{
13+
if(jumpguard == 0)
14+
{
15+
__assert_fail("0", "lc2.c", 8U, "func");
16+
goto label_1;
17+
}
18+
goto label_2;
19+
}
20+
label_2:;
21+
}
22+
}

Diff for: regression/ansi-c/goto_convert_assert/test.desc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE test-c++-front-end
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring

Diff for: regression/libcprover-cpp/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ cprover_default_properties(api-binary-driver)
44
target_include_directories(api-binary-driver
55
PUBLIC
66
${CBMC_BINARY_DIR}
7-
${CBMC_SOURCE_DIR}
7+
${CBMC_SOURCE_DIR}/src
88
# TODO: Should be fixed for the proper include form.
99
${CMAKE_CURRENT_SOURCE_DIR}/../src/libcprover-cpp/)
1010
target_link_libraries(api-binary-driver goto-programs util langapi ansi-c cprover-api-cpp)
1111

1212
# Enable test running
13-
set(test_pl_path "${CBMC_SOURCE_DIR}/../regression/test.pl")
13+
set(test_pl_path "${CBMC_SOURCE_DIR}/regression/test.pl")
1414

1515
macro(add_test_pl_profile name cmdline flag profile)
1616
add_test(

Diff for: src/CMakeLists.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
project(CBMC VERSION ${CBMC_VERSION})
2-
31
find_package(BISON REQUIRED)
42
find_package(FLEX REQUIRED)
53

@@ -66,8 +64,8 @@ endmacro(generic_flex)
6664
macro(generic_includes name)
6765
target_include_directories(${name}
6866
PUBLIC
69-
${CBMC_BINARY_DIR}
70-
${CBMC_SOURCE_DIR}
67+
${CBMC_BINARY_DIR}/src
68+
${CBMC_SOURCE_DIR}/src
7169
${CMAKE_CURRENT_BINARY_DIR}
7270
${CMAKE_CURRENT_SOURCE_DIR}
7371
)

Diff for: src/ansi-c/goto-conversion/goto_clean_expr.cpp

+12-4
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,15 @@ void goto_convertt::rewrite_boolean(exprt &expr)
114114
"' must be Boolean, but got ",
115115
irep_pretty_diagnosticst{expr});
116116

117+
const source_locationt source_location = expr.find_source_location();
118+
117119
// re-write "a ==> b" into a?b:1
118120
if(auto implies = expr_try_dynamic_cast<implies_exprt>(expr))
119121
{
120122
expr = if_exprt{
121123
std::move(implies->lhs()),
122124
std::move(implies->rhs()),
123-
true_exprt{},
125+
true_exprt{}.with_source_location(source_location),
124126
bool_typet{}};
125127
return;
126128
}
@@ -135,6 +137,8 @@ void goto_convertt::rewrite_boolean(exprt &expr)
135137
else // ID_or
136138
tmp = false_exprt();
137139

140+
tmp.add_source_location() = source_location;
141+
138142
exprt::operandst &ops = expr.operands();
139143

140144
// start with last one
@@ -146,17 +150,21 @@ void goto_convertt::rewrite_boolean(exprt &expr)
146150
DATA_INVARIANT_WITH_DIAGNOSTICS(
147151
op.is_boolean(),
148152
"boolean operators must have only boolean operands",
149-
expr.find_source_location());
153+
source_location);
150154

151155
if(expr.id() == ID_and)
152156
{
153-
if_exprt if_e(op, tmp, false_exprt());
157+
exprt if_e =
158+
if_exprt{op, tmp, false_exprt{}.with_source_location(source_location)}
159+
.with_source_location(source_location);
154160
tmp.swap(if_e);
155161
continue;
156162
}
157163
if(expr.id() == ID_or)
158164
{
159-
if_exprt if_e(op, true_exprt(), tmp);
165+
exprt if_e =
166+
if_exprt{op, true_exprt{}.with_source_location(source_location), tmp}
167+
.with_source_location(source_location);
160168
tmp.swap(if_e);
161169
continue;
162170
}

Diff for: src/ansi-c/goto-conversion/goto_convert.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -1812,8 +1812,11 @@ void goto_convertt::generate_ifthenelse(
18121812
if(
18131813
is_empty(false_case) && true_case.instructions.size() == 2 &&
18141814
true_case.instructions.front().is_assert() &&
1815-
true_case.instructions.front().condition().is_false() &&
1815+
simplify_expr(true_case.instructions.front().condition(), ns).is_false() &&
18161816
true_case.instructions.front().labels.empty() &&
1817+
true_case.instructions.back().is_other() &&
1818+
true_case.instructions.back().get_other().get_statement() ==
1819+
ID_expression &&
18171820
true_case.instructions.back().labels.empty())
18181821
{
18191822
true_case.instructions.front().condition_nonconst() = boolean_negate(guard);

Diff for: src/config.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ endif
7979
OSX_IDENTITY="Developer ID Application: Daniel Kroening"
8080

8181
# Detailed version information
82-
CBMC_VERSION = 6.1.1
82+
CBMC_VERSION = 6.2.0
8383

8484
# Use the CUDD library for BDDs, can be installed using `make -C src cudd-download`
8585
# CUDD = ../../cudd-3.0.0

Diff for: src/goto-instrument/contracts/contracts.cpp

-11
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ void code_contractst::check_apply_loop_contracts(
6868
// at the start of and end of a loop body
6969
std::vector<symbol_exprt> old_decreases_vars, new_decreases_vars;
7070

71-
// replace bound variables by fresh instances
72-
if(has_subexpr(invariant, ID_exists) || has_subexpr(invariant, ID_forall))
73-
add_quantified_variable(symbol_table, invariant, mode);
74-
7571
// instrument
7672
//
7773
// ... preamble ...
@@ -571,13 +567,6 @@ static void generate_contract_constraints(
571567
goto_programt &program,
572568
const source_locationt &location)
573569
{
574-
if(
575-
has_subexpr(instantiated_clause, ID_exists) ||
576-
has_subexpr(instantiated_clause, ID_forall))
577-
{
578-
add_quantified_variable(symbol_table, instantiated_clause, mode);
579-
}
580-
581570
goto_programt constraint;
582571
if(location.get_property_class() == ID_assume)
583572
{

Diff for: src/goto-instrument/contracts/dynamic-frames/dfcc_instrument_loop.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,6 @@ dfcc_instrument_loopt::add_prehead_instructions(
235235
// GOTO HEAD;
236236
// ```
237237

238-
// Replace bound variables by fresh instances in quantified formulas.
239-
if(has_subexpr(invariant, ID_exists) || has_subexpr(invariant, ID_forall))
240-
add_quantified_variable(symbol_table, invariant, language_mode);
241238
// initialize loop_entry history vars;
242239
auto replace_history_result = replace_history_loop_entry(
243240
symbol_table, invariant, loop_head_location, language_mode);
@@ -429,9 +426,6 @@ dfcc_instrument_loopt::add_step_instructions(
429426
dfcc_utilst::get_function_symbol(symbol_table, function_id).mode;
430427
{
431428
// Assume the loop invariant after havocing the state.
432-
// Replace bound variables by fresh instances in quantified formulas.
433-
if(has_subexpr(invariant, ID_exists) || has_subexpr(invariant, ID_forall))
434-
add_quantified_variable(symbol_table, invariant, language_mode);
435429
code_assumet assumption{invariant};
436430
assumption.add_source_location() = loop_head_location;
437431
converter.goto_convert(assumption, step_instrs, language_mode);
@@ -513,9 +507,6 @@ void dfcc_instrument_loopt::add_body_instructions(
513507
id2string(check_location.get_function()) + "." +
514508
std::to_string(cbmc_loop_id));
515509
// Assume the loop invariant after havocing the state.
516-
// Replace bound variables by fresh instances in quantified formulas.
517-
if(has_subexpr(invariant, ID_exists) || has_subexpr(invariant, ID_forall))
518-
add_quantified_variable(symbol_table, invariant, language_mode);
519510
code_assertt assertion{invariant};
520511
assertion.add_source_location() = check_location;
521512
converter.goto_convert(assertion, pre_loop_latch_instrs, language_mode);

Diff for: src/goto-instrument/contracts/dynamic-frames/dfcc_wrapper_program.cpp

-10
Original file line numberDiff line numberDiff line change
@@ -555,13 +555,6 @@ void dfcc_wrapper_programt::encode_requires_clauses()
555555
{
556556
exprt requires_lmbd =
557557
to_lambda_expr(r).application(contract_lambda_parameters);
558-
requires_lmbd.add_source_location() = r.source_location();
559-
if(
560-
has_subexpr(requires_lmbd, ID_exists) ||
561-
has_subexpr(requires_lmbd, ID_forall))
562-
add_quantified_variable(
563-
goto_model.symbol_table, requires_lmbd, language_mode);
564-
565558
source_locationt sl(r.source_location());
566559
if(statement_type == ID_assert)
567560
{
@@ -609,9 +602,6 @@ void dfcc_wrapper_programt::encode_ensures_clauses()
609602
.application(contract_lambda_parameters)
610603
.with_source_location(e);
611604

612-
if(has_subexpr(ensures, ID_exists) || has_subexpr(ensures, ID_forall))
613-
add_quantified_variable(goto_model.symbol_table, ensures, language_mode);
614-
615605
// this also rewrites ID_old expressions to fresh variables
616606
generate_history_variables_initialization(
617607
goto_model.symbol_table, ensures, language_mode, history);

Diff for: src/goto-instrument/contracts/utils.cpp

-42
Original file line numberDiff line numberDiff line change
@@ -381,48 +381,6 @@ void widen_assigns(assignst &assigns, const namespacet &ns)
381381
assigns = result;
382382
}
383383

384-
void add_quantified_variable(
385-
symbol_table_baset &symbol_table,
386-
exprt &expression,
387-
const irep_idt &mode)
388-
{
389-
auto visitor = [&symbol_table, &mode](exprt &expr) {
390-
if(expr.id() != ID_exists && expr.id() != ID_forall)
391-
return;
392-
// When a quantifier expression is found, create a fresh symbol for each
393-
// quantified variable and rewrite the expression to use those fresh
394-
// symbols.
395-
auto &quantifier_expression = to_quantifier_expr(expr);
396-
std::vector<symbol_exprt> fresh_variables;
397-
fresh_variables.reserve(quantifier_expression.variables().size());
398-
for(const auto &quantified_variable : quantifier_expression.variables())
399-
{
400-
// 1. create fresh symbol
401-
symbolt new_symbol = get_fresh_aux_symbol(
402-
quantified_variable.type(),
403-
id2string(quantified_variable.source_location().get_function()),
404-
"tmp_cc",
405-
quantified_variable.source_location(),
406-
mode,
407-
symbol_table);
408-
409-
// 2. add created fresh symbol to expression map
410-
fresh_variables.push_back(new_symbol.symbol_expr());
411-
}
412-
413-
// use fresh symbols
414-
exprt where = quantifier_expression.instantiate(fresh_variables);
415-
416-
// recursively check for nested quantified formulae
417-
add_quantified_variable(symbol_table, where, mode);
418-
419-
// replace previous variables and body
420-
quantifier_expression.variables() = fresh_variables;
421-
quantifier_expression.where() = std::move(where);
422-
};
423-
expression.visit_pre(visitor);
424-
}
425-
426384
static void replace_history_parameter_rec(
427385
symbol_table_baset &symbol_table,
428386
exprt &expr,

0 commit comments

Comments
 (0)