From 06c145c220d08317b2d7cdb82bdefb09fecf8844 Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Tue, 1 Sep 2026 22:27:46 +0200 Subject: [PATCH 1/2] Fix #7488 Fixes #7488 --- base/runtime/core_builtin_soa.odin | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/base/runtime/core_builtin_soa.odin b/base/runtime/core_builtin_soa.odin index 48c48f305..390497ec7 100644 --- a/base/runtime/core_builtin_soa.odin +++ b/base/runtime/core_builtin_soa.odin @@ -480,10 +480,14 @@ _append_soa_elems :: proc(#no_alias array: ^$T/#soa[dynamic]$E, zero_memory: boo footer := raw_soa_footer(array) if size_of(E) > 0 && arg_len > 0 { - offset := footer.len FIELD_COUNT :: len(E) when intrinsics.type_is_array(E) else intrinsics.type_struct_field_count(E) // Advance len before the copy, soa_copy_from_slice needs the final len to be set + when FIELD_COUNT != 0 { + offset := footer.len + } + footer.len += arg_len + when FIELD_COUNT == 0 { // do nothing } else when FIELD_COUNT <= 16 && ODIN_OPTIMIZATION_MODE <= .Size { From b96693446e61309bd9f38321066f1b16e1d4b225 Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Tue, 1 Sep 2026 22:56:12 +0200 Subject: [PATCH 2/2] Also fix the single elem branch to actually increase `footer.len` for `size_of(E) == 0` --- base/runtime/core_builtin_soa.odin | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/base/runtime/core_builtin_soa.odin b/base/runtime/core_builtin_soa.odin index 390497ec7..a2962e1d0 100644 --- a/base/runtime/core_builtin_soa.odin +++ b/base/runtime/core_builtin_soa.odin @@ -437,6 +437,12 @@ _append_soa_elem :: proc(#no_alias array: ^$T/#soa[dynamic]$E, zero_memory: bool err = _reserve_soa(array, cap, zero_memory, loc) // do not 'or_return' here as it could be a partial success } + if size_of(E) == 0 { + footer := raw_soa_footer(array) + footer.len += 1 + return 1, nil + } + if size_of(E) > 0 && cap(array)-len(array) > 0 { footer := raw_soa_footer(array) // Field stores are generated by the compiler's #soa