https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120987
Bug ID: 120987
Summary: gdb build with lto triggers use after free
Product: gcc
Version: 14.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
[ First reported at gdb bugzilla:
https://sourceware.org/bugzilla/show_bug.cgi?id=32571 ]
Take gdb sources, either current trunk (f.i. commit 87c1293c7d4), or tag
gdb-16.3-release.
Build the sources using:
...
#!/bin/sh
pwd=$(pwd -P)
src=$pwd/src
build=$pwd/build
install=$pwd/install
rm -Rf $build $install
mkdir -p $build $install
cd $build
CFLAGS="-O2"
CXXFLAGS="$CFLAGS"
LDFLAGS=""
LTOFLAGS="-flto=auto"
$src/configure \
CC=gcc-14 \
CXX=g++-14 \
CFLAGS="$CFLAGS $LTOFLAGS -g" \
CXXFLAGS="$CXXFLAGS $LTOFLAGS -g" \
LDFLAGS="$LDFLAGS $LTOFLAGS -g" \
--without-expat \
--disable-nls \
--disable-source-highlight \
--disable-tui \
--with-system-readline \
--with-python=no \
--with-guile=no \
--prefix=$install \
--disable-sim \
--disable-threading \
--without-debuginfod \
--without-xxhash \
--without-lzma \
2>&1 \
| tee CONFIGURELOG
make \
-j 9 \
V=1 \
all-gdb \
2>&1 \
| tee MAKELOG
...
Gdb misbehaves:
...
$ gdb -q -batch -ex "b bla.c:100"
�
Make breakpoint pending on future shared library load? (y or [n]) [answered N;
input not from terminal]
$ gdb -q -batch -ex "b bla.c:100"
;�
Make breakpoint pending on future shared library load? (y or [n]) [answered N;
input not from terminal]
$ gdb -q -batch -ex "b bla.c:100"
�
Make breakpoint pending on future shared library load? (y or [n]) [answered N;
input not from terminal]
...
Expected:
...
$ gdb -q -batch -ex "b bla.c:100"
No symbol table is loaded. Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n]) [answered N;
input not from terminal]
...
Used gcc:
...
gcc version 14.3.0 (SUSE Linux)
...
on openSUSE Tumbleweed 20250627.