Skip to content

goto-symex: do not rely on undocumented find_symbols(expr) behaviour #6726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/goto-symex/goto_symex_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Author: Daniel Kroening, [email protected]
#include <util/c_types.h>
#include <util/exception_utils.h>
#include <util/expr_util.h>
#include <util/find_symbols.h>
#include <util/invariant.h>
#include <util/std_expr.h>

Expand Down Expand Up @@ -837,13 +836,15 @@ ssa_exprt goto_symex_statet::declare(ssa_exprt ssa, const namespacet &ns)

// L2 renaming
const exprt fields = field_sensitivity.get_fields(ns, *this, ssa);
for(const auto &l1_symbol : find_symbols(fields))
{
const ssa_exprt &field_ssa = to_ssa_expr(l1_symbol);
const std::size_t field_generation = level2.increase_generation(
l1_symbol.get_identifier(), field_ssa, fresh_l2_name_provider);
CHECK_RETURN(field_generation == 1);
}
fields.visit_pre([this](const exprt &e) {
if(auto l1_symbol = expr_try_dynamic_cast<symbol_exprt>(e))
{
const ssa_exprt &field_ssa = to_ssa_expr(*l1_symbol);
const std::size_t field_generation = level2.increase_generation(
l1_symbol->get_identifier(), field_ssa, fresh_l2_name_provider);
CHECK_RETURN(field_generation == 1);
}
});

record_events.push(false);
exprt expr_l2 = rename(std::move(ssa), ns).get();
Expand Down