From 0b737050465cfd9a9a497ffed60517d52fd2e0db Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Tue, 20 Oct 2026 00:53:04 -0700 Subject: [PATCH] Sema: include sentinel in allocated result of unflattenArray --- src/Sema/comptime_ptr_access.zig | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Sema/comptime_ptr_access.zig b/src/Sema/comptime_ptr_access.zig index 96d407f9ffb2fe271fa4f1325343928bbb700d97..d421af53adb7046cf08fcb9ec0a5df3382a3e8a0 100644 --- a/src/Sema/comptime_ptr_access.zig +++ b/src/Sema/comptime_ptr_access.zig @@ -1031,13 +1031,12 @@ fn unflattenArray( } const elem_ty = ty.childType(zcu); - const buf = try arena.alloc(InternPool.Index, @intCast(ty.arrayLen(zcu))); + const buf = try arena.alloc(InternPool.Index, @intCast(ty.arrayLenIncludingSentinel(zcu))); for (buf) |*elem| { elem.* = (try unflattenArray(sema, elem_ty, elems, next_idx)).toIntern(); } - if (ty.sentinel(zcu) != null) { - // TODO: validate sentinel - _ = try unflattenArray(sema, elem_ty, elems, next_idx); + if (ty.sentinel(zcu)) |sent| { + assert(sent.toIntern() == buf[buf.len - 1]); } return pt.aggregateValue(ty, buf); } -- 2.54.0