Skip to content

Commit c34392b

Browse files
committed
std.os.linux.io_uring: work around LLVM bug
See #12014
1 parent f639cb3 commit c34392b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/std/os/linux/io_uring.zig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1902,6 +1902,12 @@ test "openat" {
19021902
const path = "test_io_uring_openat";
19031903
defer std.fs.cwd().deleteFile(path) catch {};
19041904

1905+
// Workaround for LLVM bug: https://github.com/ziglang/zig/issues/12014
1906+
const path_addr = if (builtin.zig_backend == .stage2_llvm) p: {
1907+
var workaround = path;
1908+
break :p @ptrToInt(workaround);
1909+
} else @ptrToInt(path);
1910+
19051911
const flags: u32 = os.O.CLOEXEC | os.O.RDWR | os.O.CREAT;
19061912
const mode: os.mode_t = 0o666;
19071913
const sqe_openat = try ring.openat(0x33333333, linux.AT.FDCWD, path, flags, mode);
@@ -1911,7 +1917,7 @@ test "openat" {
19111917
.ioprio = 0,
19121918
.fd = linux.AT.FDCWD,
19131919
.off = 0,
1914-
.addr = @ptrToInt(path),
1920+
.addr = path_addr,
19151921
.len = mode,
19161922
.rw_flags = flags,
19171923
.user_data = 0x33333333,

0 commit comments

Comments
 (0)