aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/stdlib/tables.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/stdlib/tables.c b/src/stdlib/tables.c
index c374f26f..cbd96395 100644
--- a/src/stdlib/tables.c
+++ b/src/stdlib/tables.c
@@ -146,7 +146,9 @@ static void Table$set_bucket(Table_t *t, const void *entry, int32_t index, const
hshow(t);
const void *key = entry;
bucket_t *buckets = t->bucket_info->buckets;
- uint64_t hash = HASH_KEY(*t, key);
+ // NOTE: I'm not sure why this needs to be marked `volatile`, but it fixes
+ // a memory issue that was hard to debug.
+ volatile uint64_t hash = HASH_KEY(*t, key);
hdebug("Hash value (mod ", (int32_t)t->bucket_info->count, ") = ", hash, "\n");
bucket_t *bucket = &buckets[hash];
if (!bucket->occupied) {