mirror of
https://github.com/ziglang/zig.git
synced 2025-12-25 07:33:08 +00:00
stage2: fix bug in genArg
When an argument is unused in the function body, still increment arg_index so we still select the correct arguments in the args slice.
This commit is contained in:
parent
29928af600
commit
a7da90071e
@ -1480,6 +1480,9 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
|
||||
}
|
||||
|
||||
fn genArg(self: *Self, inst: *ir.Inst.Arg) !MCValue {
|
||||
const arg_index = self.arg_index;
|
||||
self.arg_index += 1;
|
||||
|
||||
if (FreeRegInt == u0) {
|
||||
return self.fail(inst.base.src, "TODO implement Register enum for {}", .{self.target.cpu.arch});
|
||||
}
|
||||
@ -1488,8 +1491,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
|
||||
|
||||
try self.registers.ensureCapacity(self.gpa, self.registers.count() + 1);
|
||||
|
||||
const result = self.args[self.arg_index];
|
||||
self.arg_index += 1;
|
||||
const result = self.args[arg_index];
|
||||
|
||||
const name_with_null = inst.name[0 .. mem.lenZ(inst.name) + 1];
|
||||
switch (result) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user