Fix generic cycle deadlock in struct layout

This commit is contained in:
bymehul
2026-03-11 03:04:26 +05:30
parent c9e55d3add
commit 763c8d3a42
4 changed files with 26 additions and 2 deletions

View File

@@ -4201,8 +4201,9 @@ gb_internal i64 type_align_of_internal(Type *t, TypePath *path) {
if (t->Struct.is_packed) {
return 1;
}
type_set_offsets(t);
// Avoid forcing offset computation here. The caller's type-path state must
// be able to detect recursive field cycles before any nested struct tries to
// re-enter this struct's offset mutex.
i64 max = 1;
for_array(i, t->Struct.fields) {