Commit 67997a699a

mlugg <mlugg@mlugg.co.uk>
2023-06-24 18:01:46
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 a84a895
Changed files (1)
src
codegen
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);
     }