Skip to content

Commit c57f663

Browse files
check whether a given state exists before adding dependencies
Signed-off-by: Lucas Cordeiro <[email protected]>
1 parent ed9b801 commit c57f663

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

src/analyses/ai.h

+8
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,14 @@ class ait:public ai_baset
274274
ai_baset::clear();
275275
}
276276

277+
// this one just finds states
278+
virtual const bool state_exist(locationt l) const
279+
{
280+
typename state_mapt::const_iterator it=state_map.find(l);
281+
if(it==state_map.end()) return false;
282+
return true;
283+
}
284+
277285
protected:
278286
typedef hash_map_cont<locationt, domainT, const_target_hash> state_mapt;
279287
state_mapt state_map;

src/goto-instrument/full_slicer.cpp

+11-8
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,17 @@ void full_slicert::add_dependencies(
4141
const dependence_grapht &dep_graph,
4242
const dep_node_to_cfgt &dep_node_to_cfg)
4343
{
44-
const dependence_grapht::nodet &d_node=
45-
dep_graph[dep_graph[node.PC].get_node_id()];
46-
47-
for(dependence_grapht::edgest::const_iterator
48-
it=d_node.in.begin();
49-
it!=d_node.in.end();
50-
++it)
51-
add_to_queue(queue, dep_node_to_cfg[it->first], node.PC);
44+
if (dep_graph.state_exist(node.PC))
45+
{
46+
const dependence_grapht::nodet &d_node=
47+
dep_graph[dep_graph[node.PC].get_node_id()];
48+
49+
for(dependence_grapht::edgest::const_iterator
50+
it=d_node.in.begin();
51+
it!=d_node.in.end();
52+
++it)
53+
add_to_queue(queue, dep_node_to_cfg[it->first], node.PC);
54+
}
5255
}
5356

5457
/*******************************************************************\

0 commit comments

Comments
 (0)