authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-08-06 18:14:17-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-08-06 18:14:17-04:00
logf1b2735a2ec1994f6bf7675a1bda685b63c2350f
tree9450ad7f25d4bd5d1cc318cc6976a5a6611342bf
parent3d1a0f2ee9bcd9f109adf3b963d91bc61470592d

fix segfault when var args fn proto shows up in ir printing


1 files changed, 5 insertions(+), 1 deletions(-)

src/ir_print.cpp+5-1
...@@ -737,7 +737,11 @@ static void ir_print_fn_proto(IrPrint *irp, IrInstructionFnProto *instruction) {...@@ -737,7 +737,11 @@ static void ir_print_fn_proto(IrPrint *irp, IrInstructionFnProto *instruction) {
737 for (size_t i = 0; i < instruction->base.source_node->data.fn_proto.params.length; i += 1) {737 for (size_t i = 0; i < instruction->base.source_node->data.fn_proto.params.length; i += 1) {
738 if (i != 0)738 if (i != 0)
739 fprintf(irp->f, ",");739 fprintf(irp->f, ",");
740 ir_print_other_instruction(irp, instruction->param_types[i]);740 if (instruction->is_var_args && i == instruction->base.source_node->data.fn_proto.params.length - 1) {
741 fprintf(irp->f, "...");
742 } else {
743 ir_print_other_instruction(irp, instruction->param_types[i]);
744 }
741 }745 }
742 fprintf(irp->f, ")->");746 fprintf(irp->f, ")->");
743 ir_print_other_instruction(irp, instruction->return_type);747 ir_print_other_instruction(irp, instruction->return_type);