summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-30 15:19:25 -0300
committerGabriel Schneider <[email protected]>2026-10-30 17:02:40 -0300
commitecce844d227dcb9136a91355ea9e6ec543165fde (patch)
tree252f9af081c47503b95e1d3ad58fed2891f729b9 /build.zig
parent12d15ce9c00c96f5f7aa5bf30102d7ebebf0f9b7 (diff)
downloadpardes-ecce844d227dcb9136a91355ea9e6ec543165fde.tar.gz
pardes-ecce844d227dcb9136a91355ea9e6ec543165fde.zip
c_heap: a heap's allocator read as its bytes are, through a volatile pointer: std's stateless allocators (c_, page_, smp_, wasm_allocator) leave `ptr` undefined, and one never written outside a test (replica.zig's zstd heap over c_allocator, web.zig's over wasm_allocator) is a constant to a release build, which folded `known.ptr == current.ptr` to false: every malloc named a new allocator and the 65th panicked (the box's session aborted at about its 16th far join; the core's table held 64 copies of {ptr 0, c_allocator's vtable}); its test runs built ReleaseSafe in unit-test too, where it panicked before
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/build.zig b/build.zig
index 5e88ef68..4485140d 100644
--- a/build.zig
+++ b/build.zig
@@ -1928,18 +1928,20 @@ pub fn build(b: *std.Build) void {
const history_step = b.step("history-test", "test historical comparisons and regression gates");
const protocol_match = testMatch(b, unit_profile, test_filters, protocol_step);
const history_match = testMatch(b, unit_profile, test_filters, history_step);
- for ([_]struct { path: []const u8, libc: bool }{
+ for ([_]struct { path: []const u8, libc: bool, optimize: ?std.builtin.OptimizeMode = null }{
.{ .path = "test/history.zig", .libc = false },
.{ .path = "src/9p.zig", .libc = false },
.{ .path = "src/esp32p4_gpio.zig", .libc = false },
.{ .path = "src/esp32p4/input_rescue.zig", .libc = false },
.{ .path = "src/fonts.zig", .libc = true },
.{ .path = "src/c_heap.zig", .libc = false },
+ // Its lookup goes wrong only where the optimizer folds it.
+ .{ .path = "src/c_heap.zig", .libc = false, .optimize = .ReleaseSafe },
}) |entry| {
const tests = b.addTest(.{
.root_module = b.createModule(.{
.target = target,
- .optimize = optimize,
+ .optimize = entry.optimize orelse optimize,
.root_source_file = b.path(entry.path),
.link_libc = entry.libc,
}),