aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2021-01-21 16:09:50 +0000
committerGitHub <noreply@github.com>2021-01-21 16:09:50 +0000
commitc71c86f563cb79601b042571a01e6ea70cc25b2d (patch)
tree78c60031eeca7e26e756181814451f6cd92285d8
parent773be83cadf58abdd6e78a0741aa6dea64f7ddf3 (diff)
parent24db60eb4b5ca48d57e1fb276ed640aea699d19a (diff)
Merge pull request #821 from corruptmemory/corruptmemory/fix-for-c_vararg
Fix for `c_vararg` issue
-rw-r--r--src/ir.cpp6
-rw-r--r--src/ir_print.cpp2
2 files changed, 7 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 90cce3699..62eee2f9f 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -3469,6 +3469,12 @@ irValue *ir_emit_call(irProcedure *p, irValue *value, Array<irValue *> const &ar
}
}
+ if (is_c_vararg) {
+ for (isize i = param_count; i < args.count; i++) {
+ array_add(&processed_args, args[i]);
+ }
+ }
+
if (inlining == ProcInlining_none) {
inlining = p->inlining;
}
diff --git a/src/ir_print.cpp b/src/ir_print.cpp
index 594cc57c2..d4a63506e 100644
--- a/src/ir_print.cpp
+++ b/src/ir_print.cpp
@@ -2310,7 +2310,7 @@ void ir_print_instr(irFileBuffer *f, irModule *m, irValue *value) {
ir_print_type(f, m, t);
ir_write_byte(f, ' ');
ir_print_value(f, m, arg, t);
- param_index++;
+ arg_index++;
}
} else {
// GB_ASSERT(call->args.count == params->variables.count);