authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-01-16 14:46:50+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-01-17 20:28:43+02:00
log24646b8b5d026a75deb5b3eace0e9142f0719da0
tree56e182a27d3e52b4b6eca48848cd21439256b1b6
parent8b35f09f4ae29eb2768d47e8a8bae0f4131d6bad

windows x86_64 C ABI: pass byref structs as byref_mut


2 files changed, 1 insertions(+), 3 deletions(-)

src/codegen/llvm.zig+1-2
...@@ -10668,8 +10668,7 @@ const ParamTypeIterator = struct {...@@ -10668,8 +10668,7 @@ const ParamTypeIterator = struct {
10668 .memory => {10668 .memory => {
10669 it.zig_index += 1;10669 it.zig_index += 1;
10670 it.llvm_index += 1;10670 it.llvm_index += 1;
10671 it.byval_attr = true;10671 return .byref_mut;
10672 return .byref;
10673 },10672 },
10674 .sse => {10673 .sse => {
10675 it.zig_index += 1;10674 it.zig_index += 1;
test/c_abi/main.zig-1
...@@ -1032,7 +1032,6 @@ extern fn c_modify_by_ref_param(ByRef) ByRef;...@@ -1032,7 +1032,6 @@ extern fn c_modify_by_ref_param(ByRef) ByRef;
10321032
1033test "C function modifies by ref param" {1033test "C function modifies by ref param" {
1034 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;1034 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
1035 if (builtin.cpu.arch == .x86_64 and builtin.os.tag == .windows and builtin.mode != .Debug) return error.SkipZigTest;
10361035
1037 const res = c_modify_by_ref_param(.{ .val = 1, .arr = undefined });1036 const res = c_modify_by_ref_param(.{ .val = 1, .arr = undefined });
1038 try expect(res.val == 42);1037 try expect(res.val == 42);