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.
This commit is contained in:
mlugg
2023-06-24 17:01:46 +01:00
committed by Andrew Kelley
parent a84a895325
commit 67997a699a

View File

@@ -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);
}