summaryrefslogtreecommitdiff
path: root/src/lread.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lread.c')
-rw-r--r--src/lread.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lread.c b/src/lread.c
index 10eec3b1be0..58d518ce40b 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2917,7 +2917,18 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
if (c == '=')
{
/* Make a placeholder for #n# to use temporarily. */
- AUTO_CONS (placeholder, Qnil, Qnil);
+ /* Note: We used to use AUTO_CONS to allocate
+ placeholder, but that is a bad idea, since it
+ will place a stack-allocated cons cell into
+ the list in read_objects, which is a
+ staticpro'd global variable, and thus each of
+ its elements is marked during each GC. A
+ stack-allocated object will become garbled
+ when its stack slot goes out of scope, and
+ some other function reuses it for entirely
+ different purposes, which will cause crashes
+ in GC. */
+ Lisp_Object placeholder = Fcons (Qnil, Qnil);
Lisp_Object cell = Fcons (make_number (n), placeholder);
read_objects = Fcons (cell, read_objects);