Skip to content

Commit 4289b5e

Browse files
committed
GOTO trace: no timestamps for single-threaded programs
Avoid reading clock values when those won't be known to the solver as single-threaded source programs do not have partial-order constraints. Other back-ends were silent about this, but the incremental SMT back-end produced warnings (which the user could do nothing about).
1 parent 8d6f87b commit 4289b5e

File tree

3 files changed

+4
-34
lines changed

3 files changed

+4
-34
lines changed

src/goto-symex/build_goto_trace.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ void build_goto_trace(
220220
time_mapt time_map;
221221

222222
mp_integer current_time=0;
223+
bool has_threads = target.has_threads();
223224

224225
ssa_step_iteratort last_step_to_keep = target.SSA_steps.end();
225226
bool last_step_was_kept = false;
@@ -258,6 +259,9 @@ void build_goto_trace(
258259
else if(it->is_shared_read() || it->is_shared_write() ||
259260
it->is_atomic_end())
260261
{
262+
if(!has_threads)
263+
continue;
264+
261265
mp_integer time_before=current_time;
262266

263267
if(it->is_shared_read() || it->is_shared_write())

src/solvers/smt2_incremental/smt2_incremental_decision_procedure.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -477,20 +477,6 @@ exprt smt2_incremental_decision_proceduret::get(const exprt &expr) const
477477
}();
478478
if(!descriptor)
479479
{
480-
if(const auto symbol_expr = expr_try_dynamic_cast<symbol_exprt>(expr))
481-
{
482-
// Note this case is currently expected to be encountered during trace
483-
// generation for -
484-
// * Steps which were removed via --slice-formula.
485-
// * Getting concurrency clock values.
486-
// The below implementation which returns the given expression was chosen
487-
// based on the implementation of `smt2_convt::get` in the non-incremental
488-
// smt2 decision procedure.
489-
log.warning()
490-
<< "`get` attempted for unknown symbol, with identifier - \n"
491-
<< symbol_expr->get_identifier() << messaget::eom;
492-
return expr;
493-
}
494480
return build_expr_based_on_getting_operands(expr, *this);
495481
}
496482
if(const auto array_type = type_try_dynamic_cast<array_typet>(expr.type()))

unit/solvers/smt2_incremental/smt2_incremental_decision_procedure.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -505,26 +505,6 @@ TEST_CASE(
505505
test.sent_commands ==
506506
std::vector<smt_commandt>{smt_get_value_commandt{foo_term}});
507507
}
508-
SECTION("Get value of non-set symbol")
509-
{
510-
// smt2_incremental_decision_proceduret is used this way when cbmc is
511-
// invoked with the combination of `--trace` and `--slice-formula`.
512-
test.sent_commands.clear();
513-
const exprt bar =
514-
make_test_symbol("bar", signedbv_typet{16}).symbol_expr();
515-
REQUIRE(test.procedure.get(bar) == bar);
516-
REQUIRE(test.sent_commands.empty());
517-
}
518-
SECTION("Get value of type less symbol back")
519-
{
520-
// smt2_incremental_decision_proceduret is used this way as part of
521-
// building the goto trace, to get the partial order concurrency clock
522-
// values.
523-
test.sent_commands.clear();
524-
const symbol_exprt baz = symbol_exprt::typeless("baz");
525-
REQUIRE(test.procedure.get(baz) == baz);
526-
REQUIRE(test.sent_commands.empty());
527-
}
528508
SECTION("Get value of trivially solved expression")
529509
{
530510
test.sent_commands.clear();

0 commit comments

Comments
 (0)