fixes range loop over array elements in soa containers

This commit is contained in:
corley
2026-08-11 03:20:13 +03:00
parent 6d5dbdce13
commit 87912a8b88
6 changed files with 341 additions and 35 deletions

View File

@@ -1883,7 +1883,12 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags)
break;
case Type_Array:
is_possibly_addressable = operand.mode == Addressing_Variable || is_ptr;
// for #soa container with array element type, the element carries Addressing_SoaVariable,
// rather than Addressing_Variable; the element itself has no address,
// but each component does, so for &v in soa[i] is addressable
is_possibly_addressable = operand.mode == Addressing_Variable ||
operand.mode == Addressing_SoaVariable ||
is_ptr;
array_add(&vals, t->Array.elem);
array_add(&vals, t_int);
break;