Skip to content

Extensions to dereferencing as used by path-symex #152

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
32 changes: 31 additions & 1 deletion src/path-symex/path_symex_state_read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,37 @@ exprt path_symex_statet::dereference_rec(
exprt address=read(dereference_expr.pointer(), propagate);

// now hand over to dereference
exprt address_dereferenced=::dereference(address, var_map.ns);
exprt is_invalid;

exprt address_dereferenced=
::dereference(address, var_map.ns, is_invalid);

if(!is_invalid.is_false())
{
#ifdef DEBUG
std::cout << "Pointer " << from_expr(var_map.ns, "", src.op0())
<< " may be invalid when "
<< from_expr(var_map.ns, "", is_invalid)
<< " evaluates to true.\n";
#endif

irep_idt id="symex::nondet"+std::to_string(var_map.nondet_count);
var_map.nondet_count++;

auxiliary_symbolt nondet_symbol;
nondet_symbol.name=id;
nondet_symbol.base_name=id;
nondet_symbol.type=src.type();
var_map.new_symbols.add(nondet_symbol);

symbol_exprt nondet=nondet_symbol.symbol_expr();

if(is_invalid.is_true())
address_dereferenced=nondet;
else
address_dereferenced=
if_exprt(is_invalid, nondet, address_dereferenced);
}

// the dereferenced address is a mixture of non-SSA and SSA symbols
// (e.g., if-guards and array indices)
Expand Down
Loading