Skip to content

Commit

Permalink
Dependence graph fix
Browse files Browse the repository at this point in the history
- adds call to initialize() in parent class to initialize the states at all locations
- does not set node id in make_top/bottom/entry as get_state() is overridden to initialize the node id
  • Loading branch information
danpoe committed Jan 13, 2017
1 parent 7b899e8 commit eef9570
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
18 changes: 18 additions & 0 deletions regression/goto-instrument/dependence-graph1/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

int x;

void func()
{
int r;

r = x;
}

int main()
{
x = 1;
func();

return 0;
}

7 changes: 7 additions & 0 deletions regression/goto-instrument/dependence-graph1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CORE
main.c
--show-dependence-graph
^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
11 changes: 9 additions & 2 deletions src/analyses/dependence_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,20 @@ class dep_graph_domaint:public ai_domain_baset

void make_top() final override
{
assert(node_id!=std::numeric_limits<node_indext>::max());

has_values=tvt(true);
node_id=std::numeric_limits<node_indext>::max();
control_deps.clear();
data_deps.clear();
}

void make_bottom() final override
{
assert(node_id!=std::numeric_limits<node_indext>::max());

has_values=tvt(false);
node_id=std::numeric_limits<node_indext>::max();
control_deps.clear();
data_deps.clear();
}

void make_entry() final override
Expand Down Expand Up @@ -161,6 +167,7 @@ class dependence_grapht:

void initialize(const goto_programt &goto_program)
{
ait<dep_graph_domaint>::initialize(goto_program);
post_dominators(goto_program);
}

Expand Down

0 comments on commit eef9570

Please sign in to comment.