Skip to content

Commit 7fcfd30

Browse files
author
Daniel Kroening
authored
Merge pull request diffblue#1453 from diffblue/integer-addressees
integer dereferences are now re-written to a custom expression
2 parents 639d1aa + 2b17564 commit 7fcfd30

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/pointer-analysis/dereference.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -264,20 +264,17 @@ exprt dereferencet::dereference_typecast(
264264
return dereference_rec(op, offset, type); // just pass down
265265
else if(op_type.id()==ID_signedbv || op_type.id()==ID_unsignedbv)
266266
{
267-
// We got an integer-typed address A. We turn this back (!)
268-
// into *(type *)(A+offset), and then let some other layer
269-
// worry about it.
267+
// We got an integer-typed address A. We turn this
268+
// into integer_dereference(A+offset),
269+
// and then let some other layer worry about it.
270270

271271
exprt integer=op;
272272

273273
if(!offset.is_zero())
274274
integer=
275275
plus_exprt(offset, typecast_exprt(op, offset.type()));
276276

277-
exprt new_typecast=
278-
typecast_exprt(integer, pointer_type(type));
279-
280-
return dereference_exprt(new_typecast, type);
277+
return unary_exprt(ID_integer_dereference, integer, type);
281278
}
282279
else
283280
throw "dereferencet: unexpected cast";

src/util/irep_ids.def

+1
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,7 @@ IREP_ID_ONE(array_replace)
823823
IREP_ID_ONE(switch_case_number)
824824
IREP_ID_ONE(java_array_access)
825825
IREP_ID_ONE(java_member_access)
826+
IREP_ID_ONE(integer_dereference)
826827

827828
#undef IREP_ID_ONE
828829
#undef IREP_ID_TWO

0 commit comments

Comments
 (0)