Commit 79a69c11 authored by yb9976's avatar yb9976
Browse files

Avoid invalid memcpy calls.

parent a2394177
......@@ -178,6 +178,9 @@ void set_irn_in(ir_node *const node, int const arity, ir_node *const *const in)
}
fix_backedges(get_irg_obstack(irg), node);
/* Calling memcpy with a null pointer leads to undefined behavior,
* even if we copy zero bytes (C99 7.21.1.p2). */
if (arity > 0)
memcpy((*pOld_in) + 1, in, sizeof(ir_node *) * arity);
/* update irg flags */
......
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