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.
}
}
- 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)