[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master fce47c9 2/2: Improve offset calculation in wide int builds
From: |
Philipp Stephani |
Subject: |
master fce47c9 2/2: Improve offset calculation in wide int builds |
Date: |
Sat, 1 Aug 2020 15:04:03 -0400 (EDT) |
branch: master
commit fce47c93252fe0be14e8c169f6bab8b0fd512cab
Author: Philipp Stephani <phst@google.com>
Commit: Philipp Stephani <phst@google.com>
Improve offset calculation in wide int builds
* src/alloc.c (mark_maybe_object): Make sure that OFFSET isn’t widened
during subtraction.
---
src/alloc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index f203061..e556fc8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4641,8 +4641,10 @@ mark_maybe_object (Lisp_Object obj)
break;
}
- void *po = (char *) ((intptr_t) (char *) XLP (obj)
- + (offset - LISP_WORD_TAG (type_tag)));
+ bool overflow
+ = INT_SUBTRACT_WRAPV (offset, LISP_WORD_TAG (type_tag), &offset);
+ eassert (!overflow);
+ void *po = (char *) ((intptr_t) (char *) XLP (obj) + offset);
/* 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