vec = XVECTOR (tmp);
if (vec->header.size == 0)
invalid_syntax ("Empty byte-code object");
+
+ if (COMPILED_DOC_STRING < vec->header.size
+ && AREF (tmp, COMPILED_DOC_STRING) == make_fixnum (0))
+ {
+ /* read_list found a docstring like '(#$ . 5521)' and treated it
+ as 0. This placeholder 0 would lead to accidental sharing in
+ purecopy's hash-consing, so replace it with a (hopefully)
+ unique integer placeholder, which is negative so that it is
+ not confused with a DOC file offset. Eventually
+ Snarf-documentation should replace the placeholder with the
+ actual docstring. */
+ EMACS_UINT hash = XHASH (tmp) | (INTMASK - INTMASK / 2);
+ ASET (tmp, COMPILED_DOC_STRING, make_ufixnum (hash));
+ }
+
make_byte_code (vec);
return tmp;
}