authorgravatar for sachabarsayuracko@gmail.comglowsquid <sachabarsayuracko@gmail.com> 2026-04-22 02:00:41+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-04-22 02:00:41+02:00
log0b768cd9ddc4dde512647cd60617db23ed6ec434
treef60e4bd2294d602f49ca3d69ae36d61db3a1f602
parent3ea77badf94d996740337f6ce6e6612178627dd1

zig reduce: fix compilation (#31930)

fixes #31926 Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31930 Reviewed-by: Andrew Kelley <andrew@ziglang.org>

4 files changed, 17 insertions(+), 7 deletions(-)

ci/aarch64-macos-release.sh+3
......@@ -55,6 +55,9 @@ stage3-release/bin/zig build test docs \
5555stage3-release/bin/zig build test-std --fuzz=1K -Dno-lib -Dfuzz-only -Doptimize=ReleaseSafe
5656stage3-release/bin/zig build test-std --fuzz=1K -Dno-lib -Dfuzz-only -Doptimize=Debug
5757
58# Ensure that reduce compiles
59stage3-release/bin/zig reduce -h
60
5861# Ensure that stage3 and stage4 are byte-for-byte identical.
5962stage3-release/bin/zig build \
6063 --maxrss ${ZSF_MAX_RSS:-0} \
ci/x86_64-linux-release.sh+3
......@@ -77,6 +77,9 @@ stage3-release/bin/zig build test docs \
7777stage3-release/bin/zig build test-std --fuzz=1K -Dno-lib -Dfuzz-only -Doptimize=ReleaseSafe
7878stage3-release/bin/zig build test-std --fuzz=1K -Dno-lib -Dfuzz-only -Doptimize=Debug
7979
80# Ensure that reduce compiles
81stage3-release/bin/zig reduce -h
82
8083# Ensure that stage3 and stage4 are byte-for-byte identical.
8184stage3-release/bin/zig build \
8285 --prefix stage4-release \
ci/x86_64-windows-release.ps1+4
......@@ -61,6 +61,10 @@ CheckLastExitCode
6161# stage3-release\bin\zig.exe build test-std --fuzz=1K -Dno-lib -Dfuzz-only -Doptimize=Debug
6262# CheckLastExitCode
6363
64# Ensure that reduce compiles
65stage3-release\bin\zig.exe build reduce -h
66CheckLastExitCode
67
6468# Ensure that stage3 and stage4 are byte-for-byte identical.
6569Write-Output "Build and compare stage4..."
6670stage3-release\bin\zig.exe build `
lib/compiler/reduce/Walk.zig+7-7
......@@ -6,9 +6,9 @@ const BuiltinFn = std.zig.BuiltinFn;
66
77ast: *const Ast,
88transformations: *std.array_list.Managed(Transformation),
9unreferenced_globals: std.StringArrayHashMapUnmanaged(Ast.Node.Index),
10in_scope_names: std.StringArrayHashMapUnmanaged(u32),
11replace_names: std.StringArrayHashMapUnmanaged(u32),
9unreferenced_globals: std.array_hash_map.String(Ast.Node.Index),
10in_scope_names: std.array_hash_map.String(u32),
11replace_names: std.array_hash_map.String(u32),
1212gpa: std.mem.Allocator,
1313arena: std.mem.Allocator,
1414
......@@ -63,9 +63,9 @@ pub fn findTransformations(
6363 .transformations = transformations,
6464 .gpa = transformations.allocator,
6565 .arena = arena,
66 .unreferenced_globals = .{},
67 .in_scope_names = .{},
68 .replace_names = .{},
66 .unreferenced_globals = .empty,
67 .in_scope_names = .empty,
68 .replace_names = .empty,
6969 };
7070 defer {
7171 walk.unreferenced_globals.deinit(walk.gpa);
......@@ -607,7 +607,7 @@ fn walkBlock(
607607 {
608608 try w.transformations.append(.{ .delete_var_decl = .{
609609 .var_decl_node = stmt,
610 .references = .{},
610 .references = .empty,
611611 } });
612612 const name_tok = var_decl.ast.mut_token + 1;
613613 const name_bytes = ast.tokenSlice(name_tok);