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
This commit is contained in:
Paul Eggert 2012-08-02 13:59:49 -07:00
parent a01bbb8412
commit 79ea6c20c4
2 changed files with 11 additions and 2 deletions

View file

@ -1,5 +1,12 @@
2012-08-02 Paul Eggert <eggert@cs.ucla.edu>
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.

View file

@ -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. */