Skip to content

Commit 4076dff

Browse files
Merge pull request diffblue#218 from diffblue/issue178
Fix pointer types when converting write_stacks to expressions
2 parents 3313de5 + dfa6612 commit 4076dff

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/analyses/variable-sensitivity/write_stack.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ exprt write_stackt::to_expression() const
187187
new_expr.operands().resize(1);
188188
}
189189
new_expr.op0()=access_expr;
190+
// also need to update the type of new_expr because the index_exprt
191+
// will have been constructed with a nil op0 and therefore will not
192+
// have had its type constructed properly.
193+
new_expr.type()=access_expr.type().subtype();
190194

191195
access_expr=new_expr;
192196
}

src/analyses/variable-sensitivity/write_stack_entry.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ offset_entryt::offset_entryt(abstract_object_pointert offset_value):
4646
}
4747

4848
/// Get the expression part needed to read this stack entry. For offset entries
49-
/// this is an index expression with the index() part the offset
50-
/// \return The expression to read this part of the stack
49+
/// this is an index expression with the index() part the offset.
50+
/// It is important to note that the returned index_exprt does not have a type,
51+
/// so it will be necessary for the caller to update the type whenever the index
52+
/// expression is completed.
53+
/// \return The untyped expression to read this part of the stack
5154
exprt offset_entryt::get_access_expr() const
5255
{
5356
return index_exprt(exprt(), offset->to_constant());

0 commit comments

Comments
 (0)