Port to gcc -fcheck-pointer-bounds
commit881abfc7fb55db2d00adf352100cc58a6a86c176
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 9 Dec 2017 21:57:38 +0000 (9 13:57 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 12 Dec 2017 23:17:12 +0000 (12 15:17 -0800)
tree4bb07ccaf020ea861ce95ff4fd57bb6d2c562810
parent244346c744a6700d320a0a0fe8c796be3b3ff023
Port to gcc -fcheck-pointer-bounds

This is a minimal port, just to get Emacs running;
it does not attempt to make the pointer bounds at all tight.
* src/ptr-bounds.h: New file.
* src/alloc.c, src/gmalloc.c: Include it.
* src/alloc.c (live_string_holding, live_cons_holding)
(live_symbol_holding, live_misc_holding, garbage_collect_1)
(sweep_conses, sweep_floats):
* src/gmalloc.c (malloc_initialize_1, _free_internal_nolock)
(_realloc_internal_nolock):
Widen pointer bounds as necessary.
We're in a memory allocator so this is OK.
* src/lisp.h (lisp_h_XSYMBOL, make_lisp_symbol) [__CHKP__]:
Do not convert from pointer to integer and back again, so
that GCC does not lose track of pointer bounds.
(XSYMBOL) [__CHKP__ && !USE_LSB_TAG]: Now a compile-time error.
Although it's possible to support both -fcheck-pointer-bounds and
--with-wide-int, it's more work; keep things simple for now.
(DEFINE_LISP_SYMBOL) [__CHKP__]: Now a no-op, to avoid
trouble with unbounded pointers.
etc/NEWS
src/alloc.c
src/gmalloc.c
src/lisp.h
src/ptr-bounds.h [new file with mode: 0644]