summaryrefslogtreecommitdiff
path: root/src/profiler.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-08-15 02:18:06 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-08-15 02:18:44 -0700
commit3548fd8a53869ce6b42c47f690660cb8eddb8aab (patch)
tree4da084bfab97e61c649abb3332254d0ea898188f /src/profiler.c
parent6cbf73b5f9f51b5e25b855bf9f521c1ef070dd4a (diff)
downloademacs-3548fd8a53869ce6b42c47f690660cb8eddb8aab.tar.gz
Debug out-of-range make_fixnum args
With --enable-checking, make_fixnum (N) now checks that N is in fixnum range. Suggested by Pip Cet in: https://lists.gnu.org/r/emacs-devel/2019-07/msg00548.html A new function make_ufixnum (N) is for the rare cases where N is intended to be unsigned and is in the range 0..INTMASK. * configure.ac (AC_C_TYPEOF): Add. (HAVE_STATEMENT_EXPRESSIONS): Resurrect this macro. * src/fns.c (Frandom, hashfn_eq, hashfn_equal, hashfn_user_defined): * src/profiler.c (hashfn_profiler): Use make_ufixnum rather than make_fixum, since the argument is an unsigned integer in the range 0..INTMASK rather than a signed integer in the range MOST_NEGATIVE_FIXNUM..MOST_POSITIVE_FIXNUM. Typically this is for hashes. * src/lisp.h (lisp_h_make_fixnum_wrap) [USE_LSB_TAG]: Rename from lisp_h_make_fixnum. (lisp_h_make_fixnum): Redefine in terms of lisp_h_make_fixnum_wrap. Check for fixnum overflow on compilers like GCC that have statement expressions and typeof. (FIXNUM_OVERFLOW_P): Move up. (make_fixnum): Check for fixnum overflow. (make_ufixnum): New function, which checks that the arg fits into 0..INTMASK range.
Diffstat (limited to 'src/profiler.c')
-rw-r--r--src/profiler.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/profiler.c b/src/profiler.c
index 6b482abf335..6943905062c 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -566,7 +566,7 @@ hashfn_profiler (Lisp_Object bt, struct Lisp_Hash_Table *h)
}
else
hash = XHASH (bt);
- return make_fixnum (SXHASH_REDUCE (hash));
+ return make_ufixnum (SXHASH_REDUCE (hash));
}
static void syms_of_profiler_for_pdumper (void);