From 1fab3ccc3cb7b7bcf2de350fa206f30139c7c772 Mon Sep 17 00:00:00 2001 From: Pip Cet Date: Fri, 10 Oct 2025 11:24:27 +0000 Subject: [PATCH] Ignore partial words when creating ambiguous roots (bug#79598) * src/igc.c (word_aligned): New function. (root_create_ambig): Cover only complete words. --- src/igc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/igc.c b/src/igc.c index e1c9f0f1c20..9947abde71b 100644 --- a/src/igc.c +++ b/src/igc.c @@ -2925,10 +2925,21 @@ root_create (struct igc *gc, void *start, void *end, mps_rank_t rank, return register_root (gc, root, start, end, ambig, label); } +static bool +word_aligned (void *ptr) +{ + return ((intptr_t)ptr & (sizeof (void *) - 1)) == 0; +} + static igc_root_list * root_create_ambig (struct igc *gc, void *start, void *end, const char *label) { + /* Partial words cannot contain ambiguous references. Ignore them. */ + while (!word_aligned (end)) + end = (char *) end - 1; + igc_assert (word_aligned (start)); + igc_assert (start < end); return root_create (gc, start, end, mps_rank_ambig (), scan_ambig, NULL, true, label); }