Ignore partial words when creating ambiguous roots (bug#79598)

* src/igc.c (word_aligned): New function.
(root_create_ambig): Cover only complete words.
This commit is contained in:
Pip Cet 2025-10-10 11:24:27 +00:00 committed by Helmut Eller
parent 5787a817a6
commit 1fab3ccc3c

View file

@ -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);
}