Skip to content

integer dereferences are now re-written to a custom expression #1453

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 1 commit into from
Oct 8, 2017
Merged
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
11 changes: 4 additions & 7 deletions src/pointer-analysis/dereference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,20 +264,17 @@ exprt dereferencet::dereference_typecast(
return dereference_rec(op, offset, type); // just pass down
else if(op_type.id()==ID_signedbv || op_type.id()==ID_unsignedbv)
{
// We got an integer-typed address A. We turn this back (!)
// into *(type *)(A+offset), and then let some other layer
// worry about it.
// We got an integer-typed address A. We turn this
// into integer_dereference(A+offset),
// and then let some other layer worry about it.

exprt integer=op;

if(!offset.is_zero())
integer=
plus_exprt(offset, typecast_exprt(op, offset.type()));

exprt new_typecast=
typecast_exprt(integer, pointer_type(type));

return dereference_exprt(new_typecast, type);
return unary_exprt(ID_integer_dereference, integer, type);
}
else
throw "dereferencet: unexpected cast";
Expand Down
1 change: 1 addition & 0 deletions src/util/irep_ids.def
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,7 @@ IREP_ID_ONE(array_replace)
IREP_ID_ONE(switch_case_number)
IREP_ID_ONE(java_array_access)
IREP_ID_ONE(java_member_access)
IREP_ID_ONE(integer_dereference)

#undef IREP_ID_ONE
#undef IREP_ID_TWO