Subject: bug#78662: feature/igc: [PATCH] Make buffer_local_symbols exact roots

From: Helmut Eller <[email-masked]>
Date: Sun, 01 Jun 2025 10:37:04 +0200

Tracing buffer_local_symbols and buffer_defaults exactly as in
the patch seems to work.

>From f1709d2c66f4cb88af2645f61e761fc50e10384c Mon Sep 17 00:00:00 2001
From: Helmut Eller <[email-masked]>
Date: Sun, 1 Jun 2025 10:29:58 +0200
Subject: [PATCH] Make buffer_defaults and buffer_local_symbols exact roots

* src/igc.c (root_create_buffer): Create exact roots.
(scan_buffer): New helper.
---
 src/igc.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/igc.c b/src/igc.c
index 9c3c8e82758..f63b0fe8c88 100644
--- a/src/igc.c
+++ b/src/igc.c
@@ -2196,6 +2196,14 @@ fix_buffer (mps_ss_t ss, struct buffer *b)
   return MPS_RES_OK;
 }
 
+static mps_res_t
+scan_buffer (mps_ss_t ss, void *start, void *end, void *closure)
+{
+  igc_assert (PSEUDOVECTOR_TYPE (start) == PVEC_BUFFER);
+  igc_assert ((char *) end - (char *) start == sizeof (struct buffer));
+  return fix_buffer (ss, start);
+}
+
 static mps_res_t
 fix_glyph_pool (mps_ss_t ss, struct glyph_pool *pool)
 {
@@ -2887,8 +2895,7 @@ root_create_lispsym (struct igc *gc)
 static void
 root_create_buffer (struct igc *gc, struct buffer *b)
 {
-  void *start = &b->name_, *end = &b->own_text;
-  root_create_ambig (gc, start, end, "buffer");
+  root_create_exact (gc, b, b + 1, scan_buffer, "buffer");
 }
 
 static void
-- 
2.39.5