Commit 24646b8b5d

Veikka Tuominen <git@vexu.eu>
2023-01-16 13:46:50
windows x86_64 C ABI: pass byref structs as byref_mut
1 parent 8b35f09
Changed files (2)
src
codegen
test
c_abi
src/codegen/llvm.zig
@@ -10668,8 +10668,7 @@ const ParamTypeIterator = struct {
                             .memory => {
                                 it.zig_index += 1;
                                 it.llvm_index += 1;
-                                it.byval_attr = true;
-                                return .byref;
+                                return .byref_mut;
                             },
                             .sse => {
                                 it.zig_index += 1;
test/c_abi/main.zig
@@ -1032,7 +1032,6 @@ extern fn c_modify_by_ref_param(ByRef) ByRef;
 
 test "C function modifies by ref param" {
     if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
-    if (builtin.cpu.arch == .x86_64 and builtin.os.tag == .windows and builtin.mode != .Debug) return error.SkipZigTest;
 
     const res = c_modify_by_ref_param(.{ .val = 1, .arr = undefined });
     try expect(res.val == 42);