summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2020-08-01 16:58:06 +0200
committerPhilipp Stephani <phst@google.com>2020-08-01 17:01:00 +0200
commita2323c7ccb0eab1b6395d5d1d7e18db617354e13 (patch)
treeb70cda01788d1391dc6fddcfff68342b45ad2de1 /src
parent91d539b0772d4b2a6bdc3fbccf92dc1fcc7f747a (diff)
downloademacs-a2323c7ccb0eab1b6395d5d1d7e18db617354e13.tar.gz
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'.
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 76bb20876b0..5b9c6e4eb1f 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4638,7 +4638,8 @@ mark_maybe_object (Lisp_Object obj)
break;
}
- 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);