Skip to content

Commit cb1b3a4

Browse files
committed
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.
1 parent 92c7350 commit cb1b3a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/codegen/c.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5855,7 +5855,7 @@ fn airIntFromPtr(f: *Function, inst: Air.Inst.Index) !CValue {
58555855
try f.renderType(writer, inst_ty);
58565856
try writer.writeByte(')');
58575857
if (operand_ty.isSlice(mod)) {
5858-
try f.writeCValueMember(writer, operand, .{ .identifier = "len" });
5858+
try f.writeCValueMember(writer, operand, .{ .identifier = "ptr" });
58595859
} else {
58605860
try f.writeCValue(writer, operand, .Other);
58615861
}

0 commit comments

Comments
 (0)