From f3225cb0e6bfaf17709b0c171e77cd58fb198ce1 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 30 May 2021 07:35:04 -0700 Subject: tree: gc crash due to dummy object. * tree.c (tr_rebuild): The dummy on-stack node we use in the rebuilding process must have its generation field set to 1 rather than 0, so it looks like a mature heap object rather than a baby object. Otherwise when its pointer is assigned to another node which happens to be gen 1, the on-stack dummy will be added to the checkobj array, and gc will try to mark it. --- tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tree.c b/tree.c index 654deccf..ee1d37c4 100644 --- a/tree.c +++ b/tree.c @@ -327,7 +327,7 @@ static void tr_rebuild(val tree, struct tree *tr, val node, val parent, ucnum size) { #if CONFIG_GEN_GC - obj_t dummy = { { TNOD, 0, 0, { 0 }, 0 } }; + obj_t dummy = { { TNOD, 0, 1, { 0 }, 0 } }; #else obj_t dummy = { { TNOD, { 0 }, 0 } }; #endif -- cgit v1.2.3