Fix Linux-specific optimized test failure

The stack was not aligned as expected for `buddy_allocator_init` when
`-o:speed` was enabled, making this a test failure that only appeared
with optimizations enabled.

The data is now aligned specifically, as it should be.
This commit is contained in:
Feoramund
2025-07-22 10:40:16 -04:00
parent 19a075211f
commit 58f32cd690

View File

@@ -282,13 +282,18 @@ test_dynamic_arena :: proc(t: ^testing.T) {
@test
test_buddy :: proc(t: ^testing.T) {
N :: 4096
N :: 8192
buf: [N]u8
base := &buf[0]
address := mem.align_forward(base, size_of(mem.Buddy_Block))
delta := uintptr(address) - uintptr(base)
ba: mem.Buddy_Allocator
mem.buddy_allocator_init(&ba, buf[:], align_of(u8))
basic_sanity_test(t, mem.buddy_allocator(&ba), N / 8)
basic_sanity_test(t, mem.buddy_allocator(&ba), N / 8)
mem.buddy_allocator_init(&ba, buf[delta:delta+N/2], size_of(mem.Buddy_Block))
basic_sanity_test(t, mem.buddy_allocator(&ba), N / 16)
basic_sanity_test(t, mem.buddy_allocator(&ba), N / 16)
}
@test