From: Paul Eggert Date: Thu, 2 Aug 2012 20:59:49 +0000 (-0700) Subject: Fix macroexp crash on Windows with debugging. X-Git-Tag: emacs-24.2.90~884 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=79ea6c20c483991e1be356be10aa27f92329d47e;p=emacs.git Fix macroexp crash on Windows with debugging. * lisp.h (ASET) [ENABLE_CHECKING]: Ignore ARRAY_MARK_FLAG when checking subscripts; problem introduced with the recent "ASET (a, i, v)" rather than "AREF (a, i) = v" patch. (ARRAY_MARK_FLAG): Now a macro as well as a constant, since it's used in non-static inline functions now. Fixes: debbugs:12118 --- diff --git a/src/ChangeLog b/src/ChangeLog index c590e9fb32f..45b24436519 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2012-08-02 Paul Eggert + Fix macroexp crash on Windows with debugging (Bug#12118). + * lisp.h (ASET) [ENABLE_CHECKING]: Ignore ARRAY_MARK_FLAG when + checking subscripts; problem introduced with the recent + "ASET (a, i, v)" rather than "AREF (a, i) = v" patch. + (ARRAY_MARK_FLAG): Now a macro as well as a constant, + since it's used in non-static inline functions now. + * xfaces.c (face_at_buffer_position, face_for_overlay_string): Don't assume buffer size fits in 'int'. Remove unused local. diff --git a/src/lisp.h b/src/lisp.h index 4b54af9fe43..3d00f4dde78 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -331,7 +331,9 @@ enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = 0 }; /* In the size word of a vector, this bit means the vector has been marked. */ -static ptrdiff_t const ARRAY_MARK_FLAG = PTRDIFF_MIN; +static ptrdiff_t const ARRAY_MARK_FLAG +#define ARRAY_MARK_FLAG PTRDIFF_MIN + = ARRAY_MARK_FLAG; /* In the size word of a struct Lisp_Vector, this bit means it's really some other vector-like object. */ @@ -606,7 +608,7 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) /* The IDX==IDX tries to detect when the macro argument is side-effecting. */ #define ASET(ARRAY, IDX, VAL) \ (eassert ((IDX) == (IDX)), \ - eassert ((IDX) >= 0 && (IDX) < ASIZE (ARRAY)), \ + eassert ((IDX) >= 0 && (IDX) < (ASIZE (ARRAY) & ~ARRAY_MARK_FLAG)), \ XVECTOR (ARRAY)->contents[IDX] = (VAL)) /* Convenience macros for dealing with Lisp strings. */