Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infer destination type of cast builtins using result type #16163

Merged
merged 7 commits into from
Jun 24, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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.
  • Loading branch information
mlugg authored and andrewrk committed Jun 24, 2023
commit 67997a699a4a1ee20fb189f38077a4bb29c096b3
2 changes: 1 addition & 1 deletion src/codegen/c.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down