Commit 1e63e8d8b6

gracefu <81774659+gracefuu@users.noreply.github.com>
2021-04-11 16:34:23
stage2 x86_64: fix codegen ensureCapacity bug for function calls
Co-authored-by: joachimschmidt557 <joachim.schmidt557@outlook.com>
1 parent 62e7556
Changed files (1)
src/codegen.zig
@@ -2424,6 +2424,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
                             .x86_64 => {
                                 try self.genSetReg(inst.base.src, Type.initTag(.u32), .rax, .{ .memory = got_addr });
                                 // callq *%rax
+                                try self.code.ensureCapacity(self.code.items.len + 2);
                                 self.code.appendSliceAssumeCapacity(&[2]u8{ 0xff, 0xd0 });
                             },
                             .aarch64 => {