Port to GCC 8 -fsanitize=undefined
commita1c925fd41818cb8ad209762739b220efb919d1e
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 18 May 2018 22:45:42 +0000 (18 15:45 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 18 May 2018 22:49:48 +0000 (18 15:49 -0700)
tree4d3c95a065057114a49a9a3435d26479a086d8a1
parentf4d9fd3dd45f767eca33fbf1beee40da790fa74e
Port to GCC 8 -fsanitize=undefined

In GCC 8, gcc -fsanitize=undefined flags the undefined behavior
that Emacs relies on in its XPNTR and XSYMBOL low-level functions.
Disable undefined sanitization in these functions.  Although this
disabling doesn’t suffice if DEFINE_KEY_OPS_AS_MACROS is true, it
works for -fsanitize=undefined -DINLINING=0, which is good enough.
* src/alloc.c (macro_PNTR_ADD): New macro.
(PNTR_ADD): New function and macro.
The function disables -fsanitize=undefined.
(macro_XPNTR): Use it.
* src/conf_post.h (ATTRIBUTE_NO_SANITIZE_UNDEFINED): New macro.
* src/lisp.h (XSYMBOL): Disable -fsanitize=undefined.
src/alloc.c
src/conf_post.h
src/lisp.h