aboutsummaryrefslogtreecommitdiff
path: root/mem.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <[email protected]>2023-03-12 22:32:57 +0100
committerQuentin Carbonneaux <[email protected]>2023-03-13 10:51:41 +0100
commitf51aba22e0650032815ef791acb492220e3da7a4 (patch)
treeb3ba21657e3d68b97d1f9dd9895095ca2f6b2bec /mem.c
parent7410f90629d56d75c1410724626e6abad8418b23 (diff)
refresh stale Tmp.link before use
During coalescing, the resizing/ reordering of the sl[] array invalidates the indices stored in the 'visit' field of temps; we need to reset it before we can use it again.
Diffstat (limited to 'mem.c')
-rw-r--r--mem.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mem.c b/mem.c
index 8bde4be..36359a0 100644
--- a/mem.c
+++ b/mem.c
@@ -406,6 +406,11 @@ coalesce(Fn *fn)
/* substitute fused slots */
for (s=sl; s<&sl[nsl]; s++) {
t = &fn->tmp[s->t];
+ /* the visit link is stale,
+ * reset it before the slot()
+ * calls below
+ */
+ t->visit = s-sl;
assert(t->ndef == 1 && t->def);
if (s->s == s)
continue;