zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 67997a699a4a1ee20fb189f38077a4bb29c096b3 (tree)
parent a84a8953257ccfb70567a75017c98830eca250e3
Author: mlugg <mlugg@mlugg.co.uk>
Date:   Sat, 24 Jun 2023 17:01:46 +0100

cbe: codegen int_from_ptr of slice correctly

CBE was translating to access the `len` field rather than `ptr`.
Air.zig specifies that this operation is valid on a slice.

Diffstat:
Msrc/codegen/c.zig | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/codegen/c.zig b/src/codegen/c.zig @@ -5855,7 +5855,7 @@ fn airIntFromPtr(f: *Function, inst: Air.Inst.Index) !CValue { try f.renderType(writer, inst_ty); try writer.writeByte(')'); if (operand_ty.isSlice(mod)) { - try f.writeCValueMember(writer, operand, .{ .identifier = "len" }); + try f.writeCValueMember(writer, operand, .{ .identifier = "ptr" }); } else { try f.writeCValue(writer, operand, .Other); }