Subject: bug#36649: 27.0.50; pure space and pdumper

From: Robert Pluim <[email-masked]>
Date: Sun, 21 Jul 2019 22:20:25 +0200

>>>>> On Sun, 21 Jul 2019 19:35:01 +0000, Pip Cet <[email-masked]> said:

    Pip> Thanks! I messed up quite badly initializing the zero vector, it turns
    Pip> out, so it was trying to initialize the first entry in the zero
    Pip> vector, which, er, obviously wasn't a good idea :-)

    Pip> Can you try again with this incremental patch?

I offer two alternatives, both of which build and run:

diff --git i/src/alloc.c w/src/alloc.c
index 1b55ad8cab..206f0ce8d7 100644
--- i/src/alloc.c
+++ w/src/alloc.c
@@ -3091,7 +3091,7 @@ #define VECTOR_ELTS_MAX \
 static struct Lisp_Vector *
 allocate_vectorlike (ptrdiff_t len)
 {
-  eassert (0 < len && len <= VECTOR_ELTS_MAX);
+  eassert (0 <= len && len <= VECTOR_ELTS_MAX);
   ptrdiff_t nbytes = header_size + len * word_size;
   struct Lisp_Vector *p;
 
@@ -3151,8 +3151,8 @@ allocate_vector (ptrdiff_t len)
 init_vectors (void)
 {
   zero_vector =
-    make_lisp_ptr (allocate_vectorlike (sizeof (struct Lisp_Vector)),
-		   Lisp_Vectorlike);
+    make_lisp_ptr (allocate_vectorlike (0), Lisp_Vectorlike);
+  XVECTOR(zero_vector)->header.size = 0;
   staticpro (&zero_vector);
 }

diff --git i/src/alloc.c w/src/alloc.c
index 1b55ad8cab..294aa9a2aa 100644
--- i/src/alloc.c
+++ w/src/alloc.c
@@ -3151,8 +3151,8 @@ allocate_vector (ptrdiff_t len)
 init_vectors (void)
 {
   zero_vector =
-    make_lisp_ptr (allocate_vectorlike (sizeof (struct Lisp_Vector)),
-		   Lisp_Vectorlike);
+    make_lisp_ptr (allocate_vectorlike (1), Lisp_Vectorlike);
+  XVECTOR(zero_vector)->header.size = 0;
   staticpro (&zero_vector);
 }