aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-08-29 14:32:32 -0700
committerAndrew Kelley <andrew@ziglang.org>2025-08-30 06:04:25 -0700
commite2fdaea0b351860da5f560cbe0ec8f056b8047fd (patch)
tree3ad4719e3b01bf12d1161bfea7a20d312419fb10
parent558bea2a76179fcc00779fdd326e5a866956fc9b (diff)
downloadzig-e2fdaea0b351860da5f560cbe0ec8f056b8047fd.tar.gz
zig-e2fdaea0b351860da5f560cbe0ec8f056b8047fd.zip
Revert "std.Io.Reader: work around llvm backend bug"
This reverts commit 530cc2c1111699d9d02ad9ebef94efa6b99f5205. The compiler bug has been fixed.
-rw-r--r--lib/std/Io/Reader.zig12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/std/Io/Reader.zig b/lib/std/Io/Reader.zig
index 4cad73e8ce..7fda9a582c 100644
--- a/lib/std/Io/Reader.zig
+++ b/lib/std/Io/Reader.zig
@@ -1163,11 +1163,7 @@ pub inline fn takeStruct(r: *Reader, comptime T: type, endian: std.builtin.Endia
.@"struct" => |info| switch (info.layout) {
.auto => @compileError("ill-defined memory layout"),
.@"extern" => {
- // This code works around https://github.com/ziglang/zig/issues/25067
- // by avoiding a call to `peekStructPointer`.
- const struct_bytes = try r.takeArray(@sizeOf(T));
- var res: T = undefined;
- @memcpy(@as([]u8, @ptrCast(&res)), struct_bytes);
+ var res = (try r.takeStructPointer(T)).*;
if (native_endian != endian) std.mem.byteSwapAllFields(T, &res);
return res;
},
@@ -1192,11 +1188,7 @@ pub inline fn peekStruct(r: *Reader, comptime T: type, endian: std.builtin.Endia
.@"struct" => |info| switch (info.layout) {
.auto => @compileError("ill-defined memory layout"),
.@"extern" => {
- // This code works around https://github.com/ziglang/zig/issues/25067
- // by avoiding a call to `peekStructPointer`.
- const struct_bytes = try r.peekArray(@sizeOf(T));
- var res: T = undefined;
- @memcpy(@as([]u8, @ptrCast(&res)), struct_bytes);
+ var res = (try r.peekStructPointer(T)).*;
if (native_endian != endian) std.mem.byteSwapAllFields(T, &res);
return res;
},