Commit adab1d07 authored by Manuel Mohr's avatar Manuel Mohr
Browse files

Fix random scheduler.

After the switch to C99, the foreach_ir_nodeset macro introduced a separate
loop variable, which shadowed the local variable "irn".  Thus, an uninitialized
pointer was passed to is_cfop.
parent acb97e6f
......@@ -48,25 +48,26 @@ static ir_node *random_select(void *block_env, ir_nodeset_t *ready_set)
}
}
ir_node *irn;
ir_node *rand_node = NULL;
if (only_branches_left) {
/* at last: schedule branches */
irn = ir_nodeset_first(ready_set);
rand_node = ir_nodeset_first(ready_set);
} else {
do {
/* take 1 random node */
int n = rand() % ir_nodeset_size(ready_set);
int i = 0;
foreach_ir_nodeset(ready_set, irn, iter) {
rand_node = irn;
if (i == n) {
break;
}
++i;
}
} while (is_cfop(irn));
} while (is_cfop(rand_node));
}
return irn;
return rand_node;
}
static void *random_init_graph(ir_graph *irg)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment