Subject: bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation

From: Arash Esbati <[email-masked]>
Date: Mon, 08 May 2023 21:34:22 +0200

Eli Zaretskii <[email-masked]> writes:

> What you need is to run Emacs under GDB while it (Emacs) executes the
> command which crashes.  To find out what is that crashing command, you
> should say:
>
>   $ make V=1

Thanks for the detailed instructions; I will play with it, not there yet.

> The recipe goes like this:
>
>   sed -n 's/.*\[\(.*\)]$/\1/p' BACKTRACE | addr2line -C -f -i -p -e BINDIR/EMACS-BINARY
>
> (It is broken in the manual into two lines, because the line is long,
> but it is a single long command that runs Sed and pipes its output
> into addr2line, a program that comes with GNU Binutils.)

Yes, I think I grasped that one.  The problem I'm facing is that my
lisp/emacs_backtrace.txt looks like this:

  Backtrace:
  00007ff61166a12e
  00007ff611538be1
  00007ff611559601
  00007ff6116ce84a
  00007ff9b7977ff0
  ...

and the sed command doesn't match on the addresses above.  It works for
the example given in the manual like this:

  Backtrace:
  emacs[0x5094e4]
  emacs[0x4ed3e6]
  emacs[0x4ed504]
  /lib64/libpthread.so.0[0x375220efe0]
  /lib64/libpthread.so.0(read+0xe)[0x375220e08e]
  emacs[0x509af6]
  emacs[0x5acc26]

So in my case, sed returns nothing which is piped into addr2line.

> Can you show a full C compilation command of one of the C source
> files?  Like this:
>
>   $ cd /path/to/emacs/src
>   $ make data.o -W data.c V=1
>
> I'd like to see all of the compiler's command-line options your build
> uses.

It looks like this; line-breaks added manually:

--8<---------------cut here---------------start------------->8---
../lib-src/make-docfile -d . -g dispnew.o frame.o scroll.o         \
xdisp.o menu.o window.o charset.o coding.o category.o ccl.o        \
character.o chartab.o bidi.o  term.o terminal.o xfaces.o           \
emacs.o keyboard.o macros.o keymap.o sysdep.o bignum.o buffer.o    \
filelock.o insdel.o marker.o minibuf.o fileio.o dired.o cmds.o     \
casetab.o casefiddle.o indent.o search.o regex-emacs.o undo.o      \
alloc.o pdumper.o data.o doc.o editfns.o callint.o eval.o          \
floatfns.o fns.o sort.o font.o print.o lread.o emacs-module.o      \
syntax.o  bytecode.o comp.o dynlib.o process.o gnutls.o callproc.o \
region-cache.o sound.o timefns.o atimer.o doprnt.o intervals.o     \
textprop.o composite.o xml.o lcms.o w32notify.o  profiler.o        \
decompress.o thread.o systhread.o sqlite.o  treesit.o itree.o      \
hbfont.o w32fns.o w32menu.o w32reg.o w32font.o w32term.o w32xfns.o \
w32select.o w32uniscribe.o w32cygwinx.o w32.o w32console.o         \
w32heap.o w32inevt.o w32proc.o w32image.o fontset.o fringe.o       \
image.o  json.o    > globals.tmp
../build-aux/move-if-change globals.tmp globals.h
echo timestamp > gl-stamp
gcc  -c -mtune=generic                                \
-DUSE_CRT_DLL=1                                       \
-I /d/arash/Dev/Emacs/emacs-build-test/nt/inc -Demacs \
-I. -I. -I../lib -I../lib  -mtune=generic             \
-isystem C:/msys64/mingw64/include/librsvg-2.0        \
-isystem C:/msys64/mingw64/include/glib-2.0           \
-isystem C:/msys64/mingw64/lib/glib-2.0/include       \
-isystem C:/msys64/mingw64/include/gdk-pixbuf-2.0     \
-isystem C:/msys64/mingw64/include/libpng16           \
-isystem C:/msys64/mingw64/include/webp               \
-DLIBDEFLATE_DLL                                      \
-isystem C:/msys64/mingw64/include/cairo              \
-isystem C:/msys64/mingw64/include/freetype2          \
-isystem C:/msys64/mingw64/include/harfbuzz           \
-isystem C:/msys64/mingw64/include/pixman-1           \
-isystem C:/msys64/mingw64/include/libxml2            \
-isystem C:/msys64/mingw64/include/webp               \
-isystem C:/msys64/mingw64/include/harfbuzz           \
-isystem C:/msys64/mingw64/include/freetype2          \
-isystem C:/msys64/mingw64/include/libpng16           \
-isystem C:/msys64/mingw64/include/glib-2.0           \
-isystem C:/msys64/mingw64/lib/glib-2.0/include       \
-MMD -MF deps/data.d -MP                              \
-isystem C:/msys64/mingw64/include/p11-kit-1          \
-fno-common                                           \
-Wall                                                 \
-Warith-conversion                                    \
-Wdate-time                                           \
-Wdisabled-optimization                               \
-Wdouble-promotion                                    \
-Wduplicated-cond                                     \
-Wextra                                               \
-Wformat-signedness                                   \
-Winit-self                                           \
-Winvalid-pch                                         \
-Wlogical-op                                          \
-Wmissing-declarations                                \
-Wmissing-include-dirs                                \
-Wmissing-prototypes                                  \
-Wnested-externs                                      \
-Wnull-dereference                                    \
-Wold-style-definition                                \
-Wopenmp-simd                                         \
-Wpacked                                              \
-Wpointer-arith                                       \
-Wstrict-prototypes                                   \
-Wsuggest-attribute=noreturn                          \
-Wsuggest-final-methods                               \
-Wsuggest-final-types                                 \
-Wtrampolines                                         \
-Wuninitialized                                       \
-Wunknown-pragmas                                     \
-Wunused-macros                                       \
-Wvariadic-macros                                     \
-Wvector-operation-performance                        \
-Wwrite-strings                                       \
-Warray-bounds=2                                      \
-Wattribute-alias=2                                   \
-Wformat=2                                            \
-Wformat-truncation=2                                 \
-Wimplicit-fallthrough=5                              \
-Wshift-overflow=2                                    \
-Wuse-after-free=3                                    \
-Wvla-larger-than=4031                                \
-Wno-missing-field-initializers                       \
-Wno-override-init                                    \
-Wno-sign-compare                                     \
-Wno-type-limits                                      \
-Wno-unused-parameter                                 \
-Wno-format-nonliteral                                \
-Wno-bidi-chars                                       \
-Wno-pointer-sign                                     \
-g3 -O2 -gdwarf-2  data.c
--8<---------------cut here---------------end--------------->8---

Best, Arash