Skip to content

Commit 7204528

Browse files
committed
Remove dead symbols from assignable set
1 parent 179c18f commit 7204528

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/goto-instrument/contracts/assigns.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ void assigns_clauset::add_target(const exprt &target_expr)
110110
}
111111
}
112112

113+
void assigns_clauset::remove_target(const exprt &target_expr)
114+
{
115+
targets.erase(targett(*this, targett::normalize(target_expr)));
116+
}
117+
113118
goto_programt assigns_clauset::generate_havoc_code() const
114119
{
115120
modifiest modifies;

src/goto-instrument/contracts/assigns.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class assigns_clauset
5454
assigns_clauset(const exprt &, const messaget &, const namespacet &);
5555

5656
void add_target(const exprt &);
57+
void remove_target(const exprt &);
5758

5859
goto_programt generate_havoc_code() const;
5960
exprt generate_containment_check(const exprt &) const;

src/goto-instrument/contracts/contracts.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,13 @@ void code_contractst::check_frame_conditions(
944944
freely_assignable_symbols,
945945
assigns);
946946
}
947+
else if(instruction_it->is_dead())
948+
{
949+
freely_assignable_symbols.erase(
950+
instruction_it->get_dead().symbol().get_identifier());
951+
952+
assigns.remove_target(instruction_it->get_dead().symbol());
953+
}
947954
}
948955
}
949956

0 commit comments

Comments
 (0)