File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed
regression/goto-analyzer/dependence-graph13 Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ void func ()
2
+ {
3
+ }
4
+
5
+ void main (void )
6
+ {
7
+ func ();
8
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --show --dependence-graph
4
+ activate-multi-line-match
5
+ ^EXIT=0$
6
+ ^SIGNAL=0$
7
+ Function: main\n.*\n.*\n.*\nControl dependencies: [0-9]+
8
+ Function: func\n.*\n.*\n.*\nControl dependencies: [0-9]+
9
+ Function: __CPROVER_initialize\n.*\n.*\n.*\nControl dependencies: [0-9]+
10
+ --
11
+ Function: __CPROVER__start\n.*\n.*\n.*\nControl dependencies: [0-9]+
12
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -203,6 +203,26 @@ void dep_graph_domaint::transform(
203
203
dependence_grapht *dep_graph=dynamic_cast <dependence_grapht*>(&ai);
204
204
assert (dep_graph!=nullptr );
205
205
206
+ // We do not propagate control dependencies on function calls, i.e., only the
207
+ // entry point of a function should have a control dependency on the call
208
+ if (!control_deps.empty ())
209
+ {
210
+ const goto_programt::const_targett &dep = *control_deps.begin ();
211
+ if (dep->is_function_call ())
212
+ {
213
+ INVARIANT (
214
+ std::all_of (
215
+ std::next (control_deps.begin ()),
216
+ control_deps.end (),
217
+ [](const goto_programt::const_targett &d) {
218
+ return d->is_function_call ();
219
+ }),
220
+ " All entries must be function calls" );
221
+
222
+ control_deps.clear ();
223
+ }
224
+ }
225
+
206
226
// propagate control dependencies across function calls
207
227
if (from->is_function_call ())
208
228
{
@@ -230,6 +250,8 @@ void dep_graph_domaint::transform(
230
250
s->control_dep_candidates , control_dep_candidates);
231
251
232
252
control_deps.clear ();
253
+ control_deps.insert (from);
254
+
233
255
control_dep_candidates.clear ();
234
256
}
235
257
}
You can’t perform that action at this time.
0 commit comments