|
Dan Horák |
a539ff |
commit a40c73351c7aa2b990274122539a36fd3506cf79
|
|
Dan Horák |
a539ff |
Author: Paul Eggert <eggert@cs.ucla.edu>
|
|
Dan Horák |
a539ff |
Date: Mon Feb 20 15:09:58 2012 -0800
|
|
Dan Horák |
a539ff |
|
|
Dan Horák |
a539ff |
Fix crash due to non-contiguous EMACS_INT (Bug#10780).
|
|
Dan Horák |
a539ff |
|
|
Dan Horák |
a539ff |
* lisp.h (VALBITS): Move definition up, so that USE_LSB_TAG can use it.
|
|
Dan Horák |
a539ff |
(USE_LSB_TAG): Do not define if UINTPTR_MAX >> VALBITS == 0.
|
|
Dan Horák |
a539ff |
It's useless in that case, and it can cause problems on hosts
|
|
Dan Horák |
a539ff |
that allocate halves of EMACS_INT values separately.
|
|
Dan Horák |
a539ff |
Reported by Dan Horák. Diagnosed by Andreas Schwab in
|
|
Dan Horák |
a539ff |
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10780#30>.
|
|
Dan Horák |
a539ff |
* mem-limits.h (EXCEEDS_LISP_PTR): Define to 0 on hosts where
|
|
Dan Horák |
a539ff |
UINTPTR_MAX >> VALBITS == 0. This is required by the above change;
|
|
Dan Horák |
a539ff |
it avoids undefined behavior on hosts where shifting right by more
|
|
Dan Horák |
a539ff |
than the word width has undefined behavior.
|
|
Dan Horák |
a539ff |
|
|
Dan Horák |
a539ff |
diff --git a/src/lisp.h b/src/lisp.h
|
|
Dan Horák |
a539ff |
index 366d24a..8bfd707 100644
|
|
Dan Horák |
a539ff |
--- a/src/lisp.h
|
|
Dan Horák |
a539ff |
+++ b/src/lisp.h
|
|
Dan Horák |
a539ff |
@@ -168,6 +168,10 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
|
|
Dan Horák |
a539ff |
#define GCTYPEBITS 3
|
|
Dan Horák |
a539ff |
#endif
|
|
Dan Horák |
a539ff |
|
|
Dan Horák |
a539ff |
+#ifndef VALBITS
|
|
Dan Horák |
a539ff |
+#define VALBITS (BITS_PER_EMACS_INT - GCTYPEBITS)
|
|
Dan Horák |
a539ff |
+#endif
|
|
Dan Horák |
a539ff |
+
|
|
Dan Horák |
a539ff |
#ifndef NO_DECL_ALIGN
|
|
Dan Horák |
a539ff |
# ifndef DECL_ALIGN
|
|
Dan Horák |
a539ff |
# if HAVE_ATTRIBUTE_ALIGNED
|
|
Dan Horák |
a539ff |
@@ -191,7 +195,15 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
|
|
Dan Horák |
a539ff |
|| defined DARWIN_OS || defined __sun)
|
|
Dan Horák |
a539ff |
/* We also need to be able to specify mult-of-8 alignment on static vars. */
|
|
Dan Horák |
a539ff |
# if defined DECL_ALIGN
|
|
Dan Horák |
a539ff |
-# define USE_LSB_TAG
|
|
Dan Horák |
a539ff |
+/* mark_maybe_object assumes that EMACS_INT values are contiguous,
|
|
Dan Horák |
a539ff |
+ but this is not true on some hosts where EMACS_INT is wider than a pointer,
|
|
Dan Horák |
a539ff |
+ as they may allocate the halves of an EMACS_INT separately.
|
|
Dan Horák |
a539ff |
+ On these hosts USE_LSB_TAG is not needed because the top bits of an
|
|
Dan Horák |
a539ff |
+ EMACS_INT are unused, so define USE_LSB_TAG only on hosts where it
|
|
Dan Horák |
a539ff |
+ might be useful. */
|
|
Dan Horák |
a539ff |
+# if UINTPTR_MAX >> VALBITS != 0
|
|
Dan Horák |
a539ff |
+# define USE_LSB_TAG
|
|
Dan Horák |
a539ff |
+# endif
|
|
Dan Horák |
a539ff |
# endif
|
|
Dan Horák |
a539ff |
#endif
|
|
Dan Horák |
a539ff |
|
|
Dan Horák |
a539ff |
@@ -309,11 +321,6 @@ enum Lisp_Fwd_Type
|
|
Dan Horák |
a539ff |
Lisp_Fwd_Kboard_Obj, /* Fwd to a Lisp_Object field of kboards. */
|
|
Dan Horák |
a539ff |
};
|
|
Dan Horák |
a539ff |
|
|
Dan Horák |
a539ff |
-/* These values are overridden by the m- file on some machines. */
|
|
Dan Horák |
a539ff |
-#ifndef VALBITS
|
|
Dan Horák |
a539ff |
-#define VALBITS (BITS_PER_EMACS_INT - GCTYPEBITS)
|
|
Dan Horák |
a539ff |
-#endif
|
|
Dan Horák |
a539ff |
-
|
|
Dan Horák |
a539ff |
#ifdef USE_LISP_UNION_TYPE
|
|
Dan Horák |
a539ff |
|
|
Dan Horák |
a539ff |
#ifndef WORDS_BIGENDIAN
|
|
Dan Horák |
a539ff |
diff --git a/src/mem-limits.h b/src/mem-limits.h
|
|
Dan Horák |
a539ff |
index 472e591..244592a 100644
|
|
Dan Horák |
a539ff |
--- a/src/mem-limits.h
|
|
Dan Horák |
a539ff |
+++ b/src/mem-limits.h
|
|
Dan Horák |
a539ff |
@@ -34,7 +34,7 @@ extern int etext;
|
|
Dan Horák |
a539ff |
#endif
|
|
Dan Horák |
a539ff |
|
|
Dan Horák |
a539ff |
extern char *start_of_data (void);
|
|
Dan Horák |
a539ff |
-#if defined USE_LSB_TAG
|
|
Dan Horák |
a539ff |
+#if defined USE_LSB_TAG || UINTPTR_MAX >> VALBITS == 0
|
|
Dan Horák |
a539ff |
#define EXCEEDS_LISP_PTR(ptr) 0
|
|
Dan Horák |
a539ff |
#elif defined DATA_SEG_BITS
|
|
Dan Horák |
a539ff |
#define EXCEEDS_LISP_PTR(ptr) \
|