From 67997a699a4a1ee20fb189f38077a4bb29c096b3 Mon Sep 17 00:00:00 2001 From: mlugg Date: Sat, 24 Jun 2023 17:01:46 +0100 Subject: 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. --- src/codegen/c.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/codegen/c.zig') diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 317d77602f..fb4e619e9e 100644 --- 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); } -- cgit v1.2.3