diff options
| author | Philipp Stephani | 2020-08-01 16:58:06 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2020-08-01 17:01:00 +0200 |
| commit | a2323c7ccb0eab1b6395d5d1d7e18db617354e13 (patch) | |
| tree | b70cda01788d1391dc6fddcfff68342b45ad2de1 /src/alloc.c | |
| parent | 91d539b0772d4b2a6bdc3fbccf92dc1fcc7f747a (diff) | |
| download | emacs-a2323c7ccb0eab1b6395d5d1d7e18db617354e13.tar.gz emacs-a2323c7ccb0eab1b6395d5d1d7e18db617354e13.zip | |
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/alloc.c')
| -rw-r--r-- | src/alloc.c | 5 |
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) | |||
| 4638 | break; | 4638 | break; |
| 4639 | } | 4639 | } |
| 4640 | 4640 | ||
| 4641 | void *po = (char *) XLP (obj) + (offset - LISP_WORD_TAG (type_tag)); | 4641 | void *po = (char *) ((intptr_t) (char *) XLP (obj) |
| 4642 | + (offset - LISP_WORD_TAG (type_tag))); | ||
| 4642 | 4643 | ||
| 4643 | /* If the pointer is in the dump image and the dump has a record | 4644 | /* If the pointer is in the dump image and the dump has a record |
| 4644 | of the object starting at the place where the pointer points, we | 4645 | of the object starting at the place where the pointer points, we |
| @@ -4849,7 +4850,7 @@ mark_memory (void const *start, void const *end) | |||
| 4849 | On a host with 32-bit pointers and 64-bit Lisp_Objects, | 4850 | On a host with 32-bit pointers and 64-bit Lisp_Objects, |
| 4850 | a Lisp_Object might be split into registers saved into | 4851 | a Lisp_Object might be split into registers saved into |
| 4851 | non-adjacent words and P might be the low-order word's value. */ | 4852 | non-adjacent words and P might be the low-order word's value. */ |
| 4852 | p += (intptr_t) lispsym; | 4853 | p = (char *) ((intptr_t) p + (intptr_t) lispsym); |
| 4853 | mark_maybe_pointer (p); | 4854 | mark_maybe_pointer (p); |
| 4854 | 4855 | ||
| 4855 | verify (alignof (Lisp_Object) % GC_POINTER_ALIGNMENT == 0); | 4856 | verify (alignof (Lisp_Object) % GC_POINTER_ALIGNMENT == 0); |