Skip to content

Commit eef9570

Browse files
committed
Dependence graph fix
- 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
1 parent 7b899e8 commit eef9570

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
int x;
3+
4+
void func()
5+
{
6+
int r;
7+
8+
r = x;
9+
}
10+
11+
int main()
12+
{
13+
x = 1;
14+
func();
15+
16+
return 0;
17+
}
18+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
main.c
3+
--show-dependence-graph
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring

src/analyses/dependence_graph.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,20 @@ class dep_graph_domaint:public ai_domain_baset
9494

9595
void make_top() final override
9696
{
97+
assert(node_id!=std::numeric_limits<node_indext>::max());
98+
9799
has_values=tvt(true);
98-
node_id=std::numeric_limits<node_indext>::max();
100+
control_deps.clear();
101+
data_deps.clear();
99102
}
100103

101104
void make_bottom() final override
102105
{
106+
assert(node_id!=std::numeric_limits<node_indext>::max());
107+
103108
has_values=tvt(false);
104-
node_id=std::numeric_limits<node_indext>::max();
109+
control_deps.clear();
110+
data_deps.clear();
105111
}
106112

107113
void make_entry() final override
@@ -161,6 +167,7 @@ class dependence_grapht:
161167

162168
void initialize(const goto_programt &goto_program)
163169
{
170+
ait<dep_graph_domaint>::initialize(goto_program);
164171
post_dominators(goto_program);
165172
}
166173

0 commit comments

Comments
 (0)