Initialize the graph's depth first order array.

Unreachable nodes will cause the first elements of the array to remain
unwritten by df_search. This fixes the segfaults caused by unreachable
nodes (the reason they were an internal error before).
This commit is contained in:
Bill Currie 2012-12-19 15:55:29 +09:00
parent a7e9defebd
commit 32556b7210

View file

@ -1042,7 +1042,7 @@ flow_build_dfst (flowgraph_t *graph)
set_add (visited, graph->num_nodes);
set_add (visited, graph->num_nodes + 1);
graph->dfo = malloc (graph->num_nodes * sizeof (unsigned));
graph->dfo = calloc (graph->num_nodes, sizeof (unsigned));
graph->dfst = set_new ();
i = graph->num_nodes;
df_search (graph, visited, &i, 0);