Skip to content

Commit

Permalink
goto-synthesizer: ignore __CPROVER_-prefixed symbols
Browse files Browse the repository at this point in the history
Just like assign-instrumentation otherwise does, goto-synthesizer should
filter out symbols with prefix `__CPROVER_` from the assigns set that it
generates. The __CPROVER_going_to variables have become such an example
(seen when running Kani's regression tests).
  • Loading branch information
tautschnig committed Jun 19, 2024
1 parent 50bfa4e commit 29cd187
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/goto-synthesizer/enumerative_loop_contracts_synthesizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Author: Qinheping Hu
#include <util/find_symbols.h>
#include <util/format_expr.h>
#include <util/pointer_predicates.h>
#include <util/prefix.h>
#include <util/replace_symbol.h>
#include <util/simplify_expr.h>

Expand Down Expand Up @@ -158,6 +159,23 @@ void enumerative_loop_contracts_synthesizert::init_candidates()
get_assigns(
local_may_alias, loop_head_and_content.second, assigns_map[new_id]);

// Don't check assignable for CPROVER symbol
for(auto it = assigns_map[new_id].begin();
it != assigns_map[new_id].end();) // no ++it
{
if(auto symbol_expr = expr_try_dynamic_cast<symbol_exprt>(*it))
{
if(has_prefix(
id2string(symbol_expr->get_identifier()), CPROVER_PREFIX))
{
it = assigns_map[new_id].erase(it);
continue;
}
}

++it;
};

// remove loop-local symbols from the inferred set
cfg_info.erase_locals(assigns_map[new_id]);

Expand Down

0 comments on commit 29cd187

Please sign in to comment.