aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-12-09 10:53:51 +0000
committerGitHub <noreply@github.com>2025-12-09 10:53:51 +0000
commitc0e4d2ea0513189f526ca777ecb0216180b3798f (patch)
tree4aff60853d9c05bfcdca674b1b37d21b4593c6f8
parentfd19092850816b08a2e5aade9adf2eaa1012e50c (diff)
parent555081240b9ed90f7ccb321a13d49dee9fb15532 (diff)
Merge pull request #5981 from the-JS-hater/struct-cycle-fix
undetected type declaration cycles work-around
-rw-r--r--src/types.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/types.cpp b/src/types.cpp
index eb20b8edf..18e3b56ac 100644
--- a/src/types.cpp
+++ b/src/types.cpp
@@ -4278,6 +4278,9 @@ gb_internal i64 *type_set_offsets_of(Slice<Entity *> const &fields, bool is_pack
gb_internal bool type_set_offsets(Type *t) {
t = base_type(t);
if (t->kind == Type_Struct) {
+ if (t->Struct.are_offsets_being_processed.load()) {
+ return true;
+ }
MUTEX_GUARD(&t->Struct.offset_mutex);
if (!t->Struct.are_offsets_set) {
t->Struct.are_offsets_being_processed.store(true);