Skip to content

Commit e414eb0

Browse files
committed
Remove dead symbols from assignable set
1 parent 7773ca5 commit e414eb0

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
@@ -113,6 +113,11 @@ void assigns_clauset::add_target(const exprt &target_expr)
113113
}
114114
}
115115

116+
void assigns_clauset::remove_target(const exprt &target_expr)
117+
{
118+
targets.erase(targett(*this, targett::normalize(target_expr)));
119+
}
120+
116121
goto_programt assigns_clauset::generate_havoc_code() const
117122
{
118123
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_alias_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)