Subject: bug#49261: Segfault during loadup

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 08 Jul 2021 02:09:45 +0200

To reproduce:

make bootstrap; touch lisp/*.el; make

...
make[2]: *** [Makefile:279: ../lisp/cus-start.elc] Error 139
make[1]: *** [Makefile:765: ../lisp/cus-start.elc] Error 2
/bin/sh: line 2: 113032 Segmentation fault (core dumped)

I bisected this, and git bisect pointed me to:

commit 6cf62141c4467314f67c2ef75a4bf94d41ff050f
Author:     Paul Eggert <[email-masked]>
AuthorDate: Sat Sep 5 12:13:32 2020 -0700

    Reinstall recent GC-related changes
    
    The report that they broke macOS was a false alarm, as the
    previous commit was also broken (Bug#43152#62).

Running under gdb after the "make" fails:

gdb ./bootstrap-emacs

run -batch --no-site-file --no-site-lisp --eval '(setq load-prefer-newer t)'       -l bytecomp -f byte-compile-refresh-preloaded   -f batch-byte-compile ../lisp/abbrev.elb

#0  0x00005555557103a7 in AREF (idx=23456123314108, array=0x7ffff1a398cd)
    at lisp.h:731
#1  HASH_KEY (idx=11728061657054, h=0x7ffff1a39848) at lisp.h:2374
#2  hash_lookup (h=0x7ffff1a39848, key=0x555555cae444, hash=hash@entry=0x0)
    at fns.c:4479
...

There seems to be a corruption in the hash tables somewhere.  It's
totally reproducible with the recipe, but I haven't found more
self-contained example to reproduce it.

This does not show up with -O0, but does show up with -O1 and -O2.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no