Skip to content

Commit ffb57e8

Browse files
committed
Fixed the havocing of pointers modified by loops
The `__CPROVER_loop_invariant` contract used to incorrectly havoc the underlying pointer location instead of just havocing the value at the memory location. This commit fixes this.
1 parent 1feb6e4 commit ffb57e8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/goto-instrument/loop_utils.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@ void get_modifies_lhs(
6565
modifies.insert(lhs);
6666
else if(lhs.id()==ID_dereference)
6767
{
68-
modifiest m=local_may_alias.get(t, to_dereference_expr(lhs).pointer());
69-
for(modifiest::const_iterator m_it=m.begin();
70-
m_it!=m.end(); m_it++)
71-
get_modifies_lhs(local_may_alias, t, *m_it, modifies);
68+
auto pointer = to_dereference_expr(lhs).pointer();
69+
for(const auto &mod : local_may_alias.get(t, pointer))
70+
modifies.insert(dereference_exprt{mod, mod.type().subtype()});
7271
}
7372
else if(lhs.id()==ID_member)
7473
{

0 commit comments

Comments
 (0)