Commit 1bc22642 authored by yb9976's avatar yb9976
Browse files

Avoid calling memcpy with null pointer as source.

Such a memcpy call results in undefined behavior.
parent 95684ff5
......@@ -236,7 +236,7 @@ def insdecl(node):
for input in node.ins:
res += "\n\tr_in[" + repr(i) + "] = irn_" + input.name + ";"
i += 1
res += "\n\tmemcpy(&r_in[" + repr(insarity) + "], in, sizeof(ir_node *) * arity);\n\t"
res += "\n\tif (arity > 0) {\n\t\tmemcpy(&r_in[" + repr(insarity) + "], in, sizeof(ir_node *) * arity);\n\t}\n\t"
elif arity == 0:
return ""
else:
......
Supports Markdown
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