Fixes to tclone and other temp allocations with overaligned data.

This commit is contained in:
Christoffer Lerno
2025-04-20 21:30:36 +02:00
parent f778e75757
commit 8a2907806b
2 changed files with 22 additions and 19 deletions

View File

@@ -1,12 +1,21 @@
module test;
struct Foo @align(256)
{
int x;
}
fn void clone_test() @test
{
double x;
void *a = @clone(x);
free(a);
(void)@tclone(x);
a = @clone_aligned(x);
Foo y;
a = @clone_aligned(y);
assert(((uptr)a) % 256 == 0);
free_aligned(a);
(void)@tclone_aligned(x);
a = @tclone(y);
assert(((uptr)a) % 256 == 0);
a = @tclone(y);
assert(((uptr)a) % 256 == 0);
}