Commit a2323c7c authored by Philipp Stephani's avatar Philipp Stephani

Suppress sanitizer errors about pointer arithmetic in a few places

We perform weird pointer arithmetic due to the layout of Lisp_Objects
holding symbols.  ASan/UBSan warns about that (Bug#42530).  Suppress
the warnings by performing the arithmetic on integer types and casting
back to pointers.

* src/alloc.c (mark_maybe_object, mark_memory): Temporarily cast
pointer to 'intptr_t'.
parent 91d539b0
......@@ -4638,7 +4638,8 @@ mark_maybe_object (Lisp_Object obj)
void *po = (char *) XLP (obj) + (offset - LISP_WORD_TAG (type_tag));
void *po = (char *) ((intptr_t) (char *) XLP (obj)
+ (offset - LISP_WORD_TAG (type_tag)));
/* If the pointer is in the dump image and the dump has a record
of the object starting at the place where the pointer points, we
......@@ -4849,7 +4850,7 @@ mark_memory (void const *start, void const *end)
On a host with 32-bit pointers and 64-bit Lisp_Objects,
a Lisp_Object might be split into registers saved into
non-adjacent words and P might be the low-order word's value. */
p += (intptr_t) lispsym;
p = (char *) ((intptr_t) p + (intptr_t) lispsym);
mark_maybe_pointer (p);
verify (alignof (Lisp_Object) % GC_POINTER_ALIGNMENT == 0);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment