diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2017-12-12 12:59:27 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2017-12-12 15:17:12 -0800 |
commit | e921f97df9a11fd6f43ee040ba97c686c3fa62ee (patch) | |
tree | f88777e5fdd37fdd012d0f192ccd5ebb82f44143 /src/lisp.h | |
parent | 4295050e1194af13afa26403dd3ebdff80824ae0 (diff) | |
download | emacs-e921f97df9a11fd6f43ee040ba97c686c3fa62ee.tar.gz |
Port --fcheck-pointer-bounds to --with-wide-int
* src/lisp (XSYMBOL) [__CHKP__ && !USE_LSB_TAG]:
Bypass pointer bounds checking here,
instead of failing the entire build.
(make_lisp_symbol): Improve comment.
Diffstat (limited to 'src/lisp.h')
-rw-r--r-- | src/lisp.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lisp.h b/src/lisp.h index 56545b70946..eb31ba209a6 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -902,12 +902,15 @@ INLINE struct Lisp_Symbol * { #if USE_LSB_TAG return lisp_h_XSYMBOL (a); -#elif defined __CHKP__ -# error "pointer-checking not supported with wide integers" #else eassert (SYMBOLP (a)); intptr_t i = (intptr_t) XUNTAG (a, Lisp_Symbol); void *p = (char *) lispsym + i; +# ifdef __CHKP__ + /* Bypass pointer checking. Although this could be improved it is + probably not worth the trouble. */ + p = __builtin___bnd_set_ptr_bounds (p, sizeof (struct Lisp_Symbol)); +# endif return p; #endif } @@ -916,9 +919,11 @@ INLINE Lisp_Object make_lisp_symbol (struct Lisp_Symbol *sym) { #ifdef __CHKP__ - /* Although this should use '__builtin___bnd_narrow_ptr_bounds (sym, - sym, sizeof *sym)', that would run afoul of GCC bug 83251 - <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83251>. */ + /* Although '__builtin___bnd_narrow_ptr_bounds (sym, sym, sizeof *sym)' + should be more efficient, it runs afoul of GCC bug 83251 + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83251>. + Also, attempting to call __builtin___bnd_chk_ptr_bounds (sym, sizeof *sym) + here seems to trigger a GCC bug, as yet undiagnosed. */ char *addr = __builtin___bnd_set_ptr_bounds (sym, sizeof *sym); char *symoffset = addr - (intptr_t) lispsym; #else |