aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2017-12-12 12:59:27 -0800
committerPaul Eggert2017-12-12 15:17:12 -0800
commite921f97df9a11fd6f43ee040ba97c686c3fa62ee (patch)
treef88777e5fdd37fdd012d0f192ccd5ebb82f44143 /src
parent4295050e1194af13afa26403dd3ebdff80824ae0 (diff)
downloademacs-e921f97df9a11fd6f43ee040ba97c686c3fa62ee.tar.gz
emacs-e921f97df9a11fd6f43ee040ba97c686c3fa62ee.zip
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')
-rw-r--r--src/lisp.h15
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 *
902{ 902{
903#if USE_LSB_TAG 903#if USE_LSB_TAG
904 return lisp_h_XSYMBOL (a); 904 return lisp_h_XSYMBOL (a);
905#elif defined __CHKP__
906# error "pointer-checking not supported with wide integers"
907#else 905#else
908 eassert (SYMBOLP (a)); 906 eassert (SYMBOLP (a));
909 intptr_t i = (intptr_t) XUNTAG (a, Lisp_Symbol); 907 intptr_t i = (intptr_t) XUNTAG (a, Lisp_Symbol);
910 void *p = (char *) lispsym + i; 908 void *p = (char *) lispsym + i;
909# ifdef __CHKP__
910 /* Bypass pointer checking. Although this could be improved it is
911 probably not worth the trouble. */
912 p = __builtin___bnd_set_ptr_bounds (p, sizeof (struct Lisp_Symbol));
913# endif
911 return p; 914 return p;
912#endif 915#endif
913} 916}
@@ -916,9 +919,11 @@ INLINE Lisp_Object
916make_lisp_symbol (struct Lisp_Symbol *sym) 919make_lisp_symbol (struct Lisp_Symbol *sym)
917{ 920{
918#ifdef __CHKP__ 921#ifdef __CHKP__
919 /* Although this should use '__builtin___bnd_narrow_ptr_bounds (sym, 922 /* Although '__builtin___bnd_narrow_ptr_bounds (sym, sym, sizeof *sym)'
920 sym, sizeof *sym)', that would run afoul of GCC bug 83251 923 should be more efficient, it runs afoul of GCC bug 83251
921 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83251>. */ 924 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83251>.
925 Also, attempting to call __builtin___bnd_chk_ptr_bounds (sym, sizeof *sym)
926 here seems to trigger a GCC bug, as yet undiagnosed. */
922 char *addr = __builtin___bnd_set_ptr_bounds (sym, sizeof *sym); 927 char *addr = __builtin___bnd_set_ptr_bounds (sym, sizeof *sym);
923 char *symoffset = addr - (intptr_t) lispsym; 928 char *symoffset = addr - (intptr_t) lispsym;
924#else 929#else