Merge remote-tracking branch 'origin/master' into llvm14

This commit is contained in:
Andrew Kelley 2022-07-05 21:56:55 -07:00
commit 683ace7472
3 changed files with 10 additions and 4 deletions

View File

@ -2124,11 +2124,11 @@ test "pointer" {
try expectFmt("pointer: i32@deadbeef\n", "pointer: {*}\n", .{value});
}
{
const value = @intToPtr(*const fn () void, 0xdeadbeef);
const value = @intToPtr(*align(1) const fn () void, 0xdeadbeef);
try expectFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", .{value});
}
{
const value = @intToPtr(*const fn () void, 0xdeadbeef);
const value = @intToPtr(*align(1) const fn () void, 0xdeadbeef);
try expectFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", .{value});
}
}

View File

@ -1902,6 +1902,12 @@ test "openat" {
const path = "test_io_uring_openat";
defer std.fs.cwd().deleteFile(path) catch {};
// Workaround for LLVM bug: https://github.com/ziglang/zig/issues/12014
const path_addr = if (builtin.zig_backend == .stage2_llvm) p: {
var workaround = path;
break :p @ptrToInt(workaround);
} else @ptrToInt(path);
const flags: u32 = os.O.CLOEXEC | os.O.RDWR | os.O.CREAT;
const mode: os.mode_t = 0o666;
const sqe_openat = try ring.openat(0x33333333, linux.AT.FDCWD, path, flags, mode);
@ -1911,7 +1917,7 @@ test "openat" {
.ioprio = 0,
.fd = linux.AT.FDCWD,
.off = 0,
.addr = @ptrToInt(path),
.addr = path_addr,
.len = mode,
.rw_flags = flags,
.user_data = 0x33333333,

View File

@ -136,7 +136,7 @@ test "cast" {
const FnPtr = if (@import("builtin").zig_backend == .stage1)
?fn (*anyopaque) void
else
?*const fn (*anyopaque) void;
?*align(1) const fn (*anyopaque) void;
try testing.expect(cast(FnPtr, 0) == @intToPtr(FnPtr, @as(usize, 0)));
try testing.expect(cast(FnPtr, foo) == @intToPtr(FnPtr, @bitCast(usize, @as(isize, -1))));
}