From 527a247ee090efb089ae68fe793ce51fb6aa720a Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 6 Jan 2024 22:47:42 -0800 Subject: eval: potential gc problem in binding. * eval.c (reparent_env): This function is used in bindings helper, when special variables are involved. It makes a new environment the parent of an existing one, just by assigning the pointer. This is wrong under generational GC if it makes a mature object point to a new object. We fix it with the set macro. I've not seen a crash because of this; I caught it by inspection. --- eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eval.c b/eval.c index 26f4b701..1846c348 100644 --- a/eval.c +++ b/eval.c @@ -759,7 +759,7 @@ static val lookup_symac_lisp1(val menv, val sym) static val reparent_env(val child, val parent) { - child->e.up_env = parent; + set(mkloc(child->e.up_env, child), parent); return child; } -- cgit v1.2.3