shithub: MicroHs

Download patch

ref: 4944da4fa51bfa7344a7dcbde741160ddc2b5865
parent: 63a970aaae38aac94d512191d860584f2666682b
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Fri Jan 12 14:42:10 EST 2024

Fix longstanding bug in find_label.

--- a/src/runtime/eval.c
+++ b/src/runtime/eval.c
@@ -1118,8 +1118,8 @@
 NODEPTR *
 find_label(heapoffs_t label)
 {
-  int hash = (int)(label % shared_table_size);
-  for(int i = hash; ; i++) {
+  for(int i = (int)label; ; i++) {
+    i %= shared_table_size;
     if (shared_table[i].node == NIL) {
       /* The slot is empty, so claim and return it */
       shared_table[i].label = label;
--