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