Subject: 31.0.50; scratch/igc: segfaults on startup when called under gdb

From: Gregor Zattler <[email-masked]>
Date: Thu, 12 Dec 2024 15:26:32 +0100

Dear Emacs developers, this bug is not
relevant to my everyday usage of Emacs,
so please disregard if the report is not
helpful / appropriate at the time.

I try to use scratch/igc with my
standard Emacs runtime configuration
which includes running under gdb.  On
the way Emacs crashes (see below).

I can start Emacs like:

~/src/emacs-igc2/src$ ./emacs  --debug-init  --eval "(setq load-suffixes '(\".el\"))" --eval '(setq load-prefer-newer nil)'

this is how I collected the infos for
this very bug report.  Therefore the
standard bug report infos are from this
invocation without gdb.

Below the standard bug report infos
you'll see a gdb backtrace.  There are
17 occurrences of "optimized out" values.
This I do not understand since I tried
to configure the building process as
debugging friendly as possible.  Hints
as how to improve this are very welcome.

There is no xbacktrace, because
scratch/igc does not provide this.

I will try to keep the gdb session open,
but this is a laptop, which I use as
daily driver...

HTH and thabks for Emacs, Gregor

In GNU Emacs 31.0.50 (build 1,
 x86_64-pc-linux-gnu, cairo version
 1.16.0) of 2024-12-12 built on no
Repository revision: 2e2c41fdcda7240c63e906ef0039dcf5a35d82f2
Repository branch: scratch/igc
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure
 --infodir=/usr/share/info/emacs
 --with-json
 --with-file-notification=yes
 --with-libsystemd --with-cairo
 --with-x=yes --with-x-toolkit=no
 --without-toolkit-scroll-bars
 --without-gsettings
 --enable-check-lisp-object-type
 --enable-checking=yes,glyphs,igc_debug
 --with-native-compilation=no
 --with-mps=debug 'CFLAGS=-ggdb3 -Og
 -ffile-prefix-map=/home/grfz/src/emacs-igc2=. -fstack-protector-strong
 -Wformat -Werror=format-security'
 'CPPFLAGS=-I/home/grfz/mps-artifacts
 -Wdate-time -D_FORTIFY_SOURCE=2'
 'LDFLAGS=-L/home/grfz/mps-artifacts
 -Wl,-z,relro''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP
GNUTLS GPM HARFBUZZ JPEG LCMS2 LIBOTF
LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT
MODULES MPS NOTIFY INOTIFY OLDXMENU
PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF WEBP X11 XDBE XIM XINPUT2
XPM ZLIB

Important settings:
  value of $LC_ALL:
  value of $LC_COLLATE: de_DE.utf8
  value of $LC_CTYPE: de_DE.utf8
  value of $LC_MESSAGES: POSIX
  value of $LC_MONETARY: de_DE.utf8
  value of $LC_NUMERIC: de_DE.utf8
  value of $LC_TIME: de_DE.utf8
  value of $LANG: de_DE.utf8
  locale-coding-system: utf-8-unix

Major mode: Messages

Minor modes in effect:
  winner-mode: t
  which-key-mode: t
  savehist-mode: t
  ws-butler-global-mode: t
  delete-selection-mode: t
  which-function-mode: t
  windmove-mode: t
  xterm-mouse-mode: t
  key-chord-mode: t
  find-function-mode: t
  mail-abbrevs-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  minibuffer-regexp-mode: t
  buffer-read-only: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/grfz/src/notmuch/emacs/notmuch-lib hides /usr/local/share/emacs/site-lisp/notmuch-lib
/home/grfz/src/notmuch/emacs/coolj hides /usr/local/share/emacs/site-lisp/coolj
/home/grfz/src/notmuch/emacs/notmuch-address hides /usr/local/share/emacs/site-lisp/notmuch-address
/home/grfz/src/notmuch/emacs/notmuch-hello hides /usr/local/share/emacs/site-lisp/notmuch-hello
/home/grfz/src/notmuch/emacs/notmuch-parser hides /usr/local/share/emacs/site-lisp/notmuch-parser
/home/grfz/src/notmuch/emacs/notmuch-show hides /usr/local/share/emacs/site-lisp/notmuch-show
/home/grfz/src/notmuch/emacs/notmuch-wash hides /usr/local/share/emacs/site-lisp/notmuch-wash
/home/grfz/src/notmuch/emacs/notmuch-draft hides /usr/local/share/emacs/site-lisp/notmuch-draft
/home/grfz/src/notmuch/emacs/notmuch-tree hides /usr/local/share/emacs/site-lisp/notmuch-tree
/home/grfz/src/notmuch/emacs/notmuch-version hides /usr/local/share/emacs/site-lisp/notmuch-version
/home/grfz/src/notmuch/emacs/notmuch-jump hides /usr/local/share/emacs/site-lisp/notmuch-jump
/home/grfz/src/notmuch/emacs/notmuch-company hides /usr/local/share/emacs/site-lisp/notmuch-company
/home/grfz/src/notmuch/emacs/notmuch hides /usr/local/share/emacs/site-lisp/notmuch
/home/grfz/src/notmuch/emacs/notmuch-crypto hides /usr/local/share/emacs/site-lisp/notmuch-crypto
/home/grfz/src/notmuch/emacs/notmuch-compat hides /usr/local/share/emacs/site-lisp/notmuch-compat
/home/grfz/src/notmuch/emacs/notmuch-maildir-fcc hides /usr/local/share/emacs/site-lisp/notmuch-maildir-fcc
/home/grfz/src/notmuch/emacs/notmuch-tag hides /usr/local/share/emacs/site-lisp/notmuch-tag
/home/grfz/src/notmuch/emacs/notmuch-message hides /usr/local/share/emacs/site-lisp/notmuch-message
/home/grfz/src/notmuch/emacs/notmuch-print hides /usr/local/share/emacs/site-lisp/notmuch-print
/home/grfz/src/notmuch/emacs/notmuch-mua hides /usr/local/share/emacs/site-lisp/notmuch-mua
/home/grfz/src/notmuch/emacs/notmuch-query hides /usr/local/share/emacs/site-lisp/notmuch-query
/home/grfz/src/notmuch/emacs/notmuch-address hides /home/grfz/.config/emacs/elisp/notmuch-address
/home/grfz/src/ol-notmuch/ol-notmuch hides /home/grfz/.config/emacs/elisp/ol-notmuch
/home/grfz/.config/emacs/elpa-31.0/magit-4.1.3/magit-autorevert hides /home/grfz/.config/emacs/elpa-31.0/magit-section-4.1.3/magit-autorevert
/home/grfz/.config/emacs/elpa-31.0/transient-0.8.1/transient hides /home/grfz/src/emacs-igc2/lisp/transient

Features:
(shadow sort orgalist wcheck-mode
ecomplete mail-extr emacsbug tramp
tramp-cache time-stamp trampver
tramp-integration tramp-message
tramp-compat xdg shell tramp-loaddefs
add-log rainbow-delimiters winner
which-key ol-notmuch notmuch
notmuch-tree notmuch-jump notmuch-hello
notmuch-show notmuch-print
notmuch-crypto notmuch-mua
notmuch-message notmuch-draft
notmuch-maildir-fcc notmuch-address
notmuch-company notmuch-parser
notmuch-wash diff-mode track-changes
coolj goto-addr icalendar diary-lib
diary-loaddefs notmuch-tag crm
notmuch-lib notmuch-version
notmuch-compat hl-line compat
org-contrib org-crypt org-protocol
org-clock ob-plantuml gnus-alias advice
finder-inf savehist auth-source-pass
holidays holiday-loaddefs ws-butler
delsel modus-operandi-theme modus-themes
which-func windmove xt-mouse edmacro
kmacro key-chord org ob ob-ref ob-lob
ob-table ob-exp org-macro org-pcomplete
pcomplete org-list org-footnote
org-faces org-entities noutline outline
so-long ob-emacs-lisp org-table
org-loaddefs find-func cal-menu calendar
cal-loaddefs gnus-sum shr pixel-fill
kinsoku url-file svg dom gnus-group
mm-url gnus-undo gnus-start gnus-dbus
dbus xml gnus-cloud nnimap nnmail
mail-source imap rfc2104 utf7 nnoo
parse-time iso8601 gnus-spec gnus-int
gnus-range gnus-win gnus message
yank-media dired desktop frameset
dired-loaddefs autorevert filenotify
rfc822 mml mailabbrev sendmail gmm-utils
mailheader nnheader mail-utils range
ob-tangle ol org-src sh-script flymake
project warnings thingatpt smie treesit
shortdoc executable skeleton org-keys oc
ob-comint ob-core org-cycle org-fold
org-fold-core org-element-ast org-compat
ob-eval org-version org-macs format-spec
use-package use-package-ensure
use-package-delight use-package-diminish
use-package-bind-key bind-key
use-package-core async-autoloads
csv-mode-autoloads debbugs-autoloads
dired-git-info-autoloads
hyperbole-autoloads kotl-autoloads hact
set hhist key-chord-autoloads
magit-autoloads magit-section-autoloads
dash-autoloads org-contrib-autoloads
orgalist-autoloads paredit-autoloads
rainbow-delimiters-autoloads
transient-autoloads
wcheck-mode-autoloads info speedbar
imenu ezimage dframe
with-editor-autoloads
ws-butler-autoloads package let-alist
browse-url url url-proxy url-privacy
url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf
url-util mm-view mml-smime mml-sec epa
gnus-util time-date smime gnutls puny
dig mailcap url-handlers mm-decode
mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr url-parse auth-source eieio
eieio-core password-cache json map
byte-opt bytecomp byte-compile compile
rx text-property-search comint
easy-mmode files-x ansi-osc ansi-color
ring url-vars epg cl-extra help-mode
derived cl-seq rfc6068 epg-config subr-x
cl-macs inline gv pcase cus-edit pp
cus-load icons wid-edit cl-loaddefs
cl-lib rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode
mwheel term/x-win x-win term/common-win
x-dnd touch-screen tool-bar dnd fontset
image regexp-opt fringe tabulated-list
replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer
select scroll-bar mouse jit-lock
font-lock syntax font-core
term/tty-colors frame minibuffer nadvice
seq simple cl-generic indonesian
philippine cham georgian utf-8-lang
misc-lang vietnamese tibetan thai
tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak
czech european ethiopic indian cyrillic
chinese composite emoji-zwj charscript
charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray
oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp
files window text-properties overlay
sha1 md5 base64 format env code-pages
mule custom widget keymap
hashtable-print-readable backquote
threads dbusbind inotify lcms2
dynamic-setting font-render-setting
cairo xinput2 x multi-tty move-toolbar
make-network-process mps emacs)

Memory information:
((conses 24 0 0) (symbols 56 0 0) (strings 40 0 0) (string-bytes 1 0)
 (vectors 24 0) (vector-slots 8 0 0) (floats 24 0 0) (intervals 64 0 0)
 (buffers 992 0))

Starting program: /home/grfz/src/emacs-igc2/src/emacs --debug-init --eval "(setq load-suffixes (quote (\".el\")))" --eval "(setq load-prefer-newer nil)" -xrm --init-directory="${USER_EMACS_DIRECTORY}"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after vfork from child process 1070205]

Program received signal SIGSEGV, Segmentation fault.
0x0000555555779816 in XSETCDR (c=..., n=n@entry=...) at ./src/lisp.h:1605
1605	  *xcdr_addr (c) = n;
#0  0x0000555555779816 in XSETCDR (c=..., n=n@entry=...) at ./src/lisp.h:1605
#1  0x0000555555780f82 in read0 (readcharfun=readcharfun@entry=..., locate_syms=locate_syms@entry=false) at ./src/lread.c:4470
#2  0x00005555557813d1 in read_internal_start (stream=stream@entry=..., start=start@entry=..., end=end@entry=..., locate_syms=locate_syms@entry=false) at ./src/lread.c:2769
#3  0x00005555557814ef in Fread (stream=...) at ./src/lisp.h:1226
#4  0x000055555574ff86 in funcall_subr (subr=0x555555f96960 <Sread>, numargs=numargs@entry=1, args=args@entry=0x7fffffffb918) at ./src/eval.c:3167
#5  0x0000555555751ae4 in funcall_general (fun=..., numargs=numargs@entry=1, args=args@entry=0x7fffffffb918) at ./src/eval.c:3046
#6  0x000055555574ebce in Ffuncall (nargs=nargs@entry=2, args=args@entry=0x7fffffffb910) at ./src/eval.c:3099
#7  0x0000555555781db8 in readevalloop (readcharfun=readcharfun@entry=..., infile0=infile0@entry=0x0, sourcename=sourcename@entry=..., printflag=false, unibyte=..., unibyte@entry=..., readfun=..., readfun@entry=..., start=..., end=...) at ./src/lread.c:2518
#8  0x0000555555782ddf in Feval_buffer (buffer=..., printflag=..., filename=..., unibyte=..., do_allow_print=...) at ./src/lread.c:2613
#9  0x000055555574ffe6 in funcall_subr (subr=0x555555f969e0 <Seval_buffer>, numargs=numargs@entry=5, args=args@entry=0x7fffe2200470) at ./src/eval.c:3175
#10 0x00005555557903c1 in exec_byte_code (fun=..., fun@entry=..., args_template=<optimized out>, nargs=<optimized out>, nargs@entry=4, args=<optimized out>, args@entry=0x7fffffffbd38) at ./src/bytecode.c:828
#11 0x00005555557516f6 in funcall_lambda (fun=fun@entry=..., nargs=nargs@entry=4, arg_vector=arg_vector@entry=0x7fffffffbd38) at ./src/eval.c:3258
#12 0x0000555555751af4 in funcall_general (fun=..., numargs=numargs@entry=4, args=args@entry=0x7fffffffbd38) at ./src/eval.c:3050
#13 0x000055555574ebce in Ffuncall (nargs=nargs@entry=5, args=args@entry=0x7fffffffbd30) at ./src/eval.c:3099
#14 0x000055555578280a in Fload (file=file@entry=..., noerror=noerror@entry=..., nomessage=..., nomessage@entry=..., nosuffix=..., nosuffix@entry=..., must_suffix=..., must_suffix@entry=...) at ./src/lread.c:1616
#15 0x0000555555782c63 in save_match_data_load (file=file@entry=..., noerror=noerror@entry=..., nomessage=nomessage@entry=..., nosuffix=nosuffix@entry=..., must_suffix=must_suffix@entry=...) at ./src/lread.c:1780
#16 0x000055555574ea8b in load_with_autoload_queue (file=..., noerror=noerror@entry=..., nomessage=nomessage@entry=..., nosuffix=nosuffix@entry=..., must_suffix=must_suffix@entry=...) at ./src/eval.c:2383
#17 0x00005555557610e8 in Frequire (feature=..., filename=..., noerror=...) at ./src/fns.c:3793
#18 0x000055555574ffae in funcall_subr (subr=0x555555f94da0 <Srequire>, numargs=numargs@entry=1, args=args@entry=0x7fffe2200378) at ./src/eval.c:3171
#19 0x00005555557903c1 in exec_byte_code (fun=..., fun@entry=..., args_template=<optimized out>, nargs=<optimized out>, nargs@entry=2, args=<optimized out>, args@entry=0x7fffffffc110) at ./src/bytecode.c:828
#20 0x00005555557516f6 in funcall_lambda (fun=fun@entry=..., nargs=nargs@entry=2, arg_vector=arg_vector@entry=0x7fffffffc110) at ./src/eval.c:3258
#21 0x00005555557520ca in apply_lambda (fun=..., fun@entry=..., args=..., count=count@entry=...) at ./src/eval.c:3221
#22 0x000055555575132b in eval_sub (form=..., form@entry=...) at ./src/eval.c:2651
#23 0x00005555557515be in Fprogn (body=...) at ./src/eval.c:443
#24 0x00005555557524c7 in Flet (args=...) at ./src/eval.c:1113
#25 0x0000555555750fcc in eval_sub (form=...) at ./src/eval.c:2555
#26 0x000055555577c316 in readevalloop_eager_expand_eval (val=val@entry=..., macroexpand=macroexpand@entry=...) at ./src/lread.c:2356
#27 0x0000555555781e35 in readevalloop (readcharfun=readcharfun@entry=..., infile0=infile0@entry=0x0, sourcename=sourcename@entry=..., printflag=false, unibyte=..., unibyte@entry=..., readfun=..., readfun@entry=..., start=..., end=...) at ./src/lread.c:2538
#28 0x0000555555782ddf in Feval_buffer (buffer=..., printflag=..., filename=..., unibyte=..., do_allow_print=...) at ./src/lread.c:2613
#29 0x000055555574ffe6 in funcall_subr (subr=0x555555f969e0 <Seval_buffer>, numargs=numargs@entry=5, args=args@entry=0x7fffe22002c0) at ./src/eval.c:3175
#30 0x00005555557903c1 in exec_byte_code (fun=..., fun@entry=..., args_template=<optimized out>, nargs=<optimized out>, nargs@entry=4, args=<optimized out>, args@entry=0x7fffffffc898) at ./src/bytecode.c:828
#31 0x00005555557516f6 in funcall_lambda (fun=fun@entry=..., nargs=nargs@entry=4, arg_vector=arg_vector@entry=0x7fffffffc898) at ./src/eval.c:3258
#32 0x0000555555751af4 in funcall_general (fun=..., numargs=numargs@entry=4, args=args@entry=0x7fffffffc898) at ./src/eval.c:3050
#33 0x000055555574ebce in Ffuncall (nargs=nargs@entry=5, args=args@entry=0x7fffffffc890) at ./src/eval.c:3099
#34 0x000055555578280a in Fload (file=..., noerror=..., nomessage=..., nosuffix=..., must_suffix=...) at ./src/lread.c:1616
#35 0x000055555574ffe6 in funcall_subr (subr=0x555555f96a60 <Sload>, numargs=numargs@entry=3, args=args@entry=0x7fffe2200218) at ./src/eval.c:3175
#36 0x00005555557903c1 in exec_byte_code (fun=..., fun@entry=..., args_template=<optimized out>, nargs=<optimized out>, nargs@entry=0, args=<optimized out>, args@entry=0x7fffffffcc08) at ./src/bytecode.c:828
#37 0x00005555557516f6 in funcall_lambda (fun=fun@entry=..., nargs=nargs@entry=0, arg_vector=arg_vector@entry=0x7fffffffcc08) at ./src/eval.c:3258
#38 0x0000555555751af4 in funcall_general (fun=..., numargs=numargs@entry=0, args=args@entry=0x7fffffffcc08) at ./src/eval.c:3050
#39 0x000055555574ebce in Ffuncall (nargs=nargs@entry=1, args=args@entry=0x7fffffffcc00) at ./src/eval.c:3099
#40 0x00005555557502d4 in call0 (fn=...) at ./src/lisp.h:3780
#41 Fhandler_bind_1 (nargs=<optimized out>, args=0x7fffe2200160) at ./src/eval.c:1483
#42 0x00005555557500e8 in funcall_subr (subr=0x555555f93620 <Shandler_bind_1>, numargs=numargs@entry=3, args=args@entry=0x7fffe2200160) at ./src/eval.c:3190
#43 0x00005555557903c1 in exec_byte_code (fun=..., fun@entry=..., args_template=<optimized out>, nargs=<optimized out>, nargs@entry=0, args=<optimized out>, args@entry=0x7fffffffce70) at ./src/bytecode.c:828
#44 0x00005555557516f6 in funcall_lambda (fun=fun@entry=..., nargs=nargs@entry=0, arg_vector=arg_vector@entry=0x7fffffffce70) at ./src/eval.c:3258
#45 0x00005555557520ca in apply_lambda (fun=..., fun@entry=..., args=..., count=count@entry=...) at ./src/eval.c:3221
#46 0x000055555575132b in eval_sub (form=..., form@entry=...) at ./src/eval.c:2651
#47 0x0000555555752bd0 in Feval (form=..., lexical=lexical@entry=...) at ./src/eval.c:2463
#48 0x00005555556c2f11 in top_level_2 () at ./src/lisp.h:1226
#49 0x000055555574d78f in internal_condition_case (bfun=bfun@entry=0x5555556c2eee <top_level_2>, handlers=..., handlers@entry=..., hfun=hfun@entry=0x5555556c9fb2 <cmd_error>) at ./src/eval.c:1618
#50 0x00005555556c1a0d in top_level_1 (ignore=..., ignore@entry=...) at ./src/lisp.h:1226
#51 0x000055555574d69a in internal_catch (tag=..., tag@entry=..., func=func@entry=0x5555556c19bb <top_level_1>, arg=..., arg@entry=...) at ./src/eval.c:1297
#52 0x00005555556c1955 in command_loop () at ./src/lisp.h:1226
#53 0x00005555556c9ac8 in recursive_edit_1 () at ./src/keyboard.c:760
#54 0x00005555556c9e6a in Frecursive_edit () at ./src/keyboard.c:843
#55 0x00005555556c1372 in main (argc=8, argv=0x7fffffffd278) at ./src/emacs.c:2646