diff --git a/regression/goto-instrument/dependence-graph1/main.c b/regression/goto-instrument/dependence-graph1/main.c new file mode 100644 index 00000000000..e7b639d2070 --- /dev/null +++ b/regression/goto-instrument/dependence-graph1/main.c @@ -0,0 +1,18 @@ + +int x; + +void func() +{ + int r; + + r = x; +} + +int main() +{ + x = 1; + func(); + + return 0; +} + diff --git a/regression/goto-instrument/dependence-graph1/test.desc b/regression/goto-instrument/dependence-graph1/test.desc new file mode 100644 index 00000000000..caef399aa9c --- /dev/null +++ b/regression/goto-instrument/dependence-graph1/test.desc @@ -0,0 +1,7 @@ +CORE +main.c +--show-dependence-graph +^EXIT=0$ +^SIGNAL=0$ +-- +^warning: ignoring diff --git a/src/analyses/ai.cpp b/src/analyses/ai.cpp index 552649d6009..4bc490a726b 100644 --- a/src/analyses/ai.cpp +++ b/src/analyses/ai.cpp @@ -499,10 +499,11 @@ void ai_baset::sequential_fixedpoint( const goto_functionst &goto_functions, const namespacet &ns) { - // do each function at least once + goto_functionst::function_mapt::const_iterator + f_it=goto_functions.function_map.find(goto_functions.entry_point()); - forall_goto_functions(it, goto_functions) - fixedpoint(it->second.body, goto_functions, ns); + if(f_it!=goto_functions.function_map.end()) + fixedpoint(f_it->second.body, goto_functions, ns); } /*******************************************************************\ diff --git a/src/analyses/dependence_graph.h b/src/analyses/dependence_graph.h index 15c0828fef6..07bf28baa1b 100644 --- a/src/analyses/dependence_graph.h +++ b/src/analyses/dependence_graph.h @@ -94,14 +94,20 @@ class dep_graph_domaint:public ai_domain_baset void make_top() final override { + assert(node_id!=std::numeric_limits::max()); + has_values=tvt(true); - node_id=std::numeric_limits::max(); + control_deps.clear(); + data_deps.clear(); } void make_bottom() final override { + assert(node_id!=std::numeric_limits::max()); + has_values=tvt(false); - node_id=std::numeric_limits::max(); + control_deps.clear(); + data_deps.clear(); } void make_entry() final override @@ -161,6 +167,7 @@ class dependence_grapht: void initialize(const goto_programt &goto_program) { + ait::initialize(goto_program); post_dominators(goto_program); }