https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115943
Bug ID: 115943
Summary: g++ generates contradictory line table entries
Product: gcc
Version: 14.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: blarsen at redhat dot com
Target Milestone: ---
Created attachment 58670
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58670&action=edit
minimal cpp code that reproduces the issue
The issue:
GCC is generating some superfluous and many contradicting entries to the line
table of the binary. Here's a snippet of the line table as printed by GDB:
INDEX LINE REL-ADDRESS UNREL-ADDRESS IS-STMT
0 7 0x0000000000401126 0x0000000000401126 Y
1 8 0x0000000000401126 0x0000000000401126 Y
2 8 0x0000000000401126 0x0000000000401126
All these entries refer to the same instruction, but 0 and 1 say that
instruction is a statement, while entry 2 says it isn't be (contradictory).
Entry 0 says the instruction belongs to the line declaring the function, while
1 and 2 say it belongs to the first line in the function, which is quite
confusing and redundant.
Entry 1 is set via a Special Opcode, and there are a few cases where a line
table entry is set through a special opcode, then its is_stmt status is changed
and it is copied again. It almost looks as though gcc isn't considering special
opcodes as though they cause a DW_LNS_copy.
command line:
g++ -fPIC -Og -g gcc_reproducer.cpp
GCC information:
gcc version 14.1.1 20240701 (Red Hat 14.1.1-7) (GCC)
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --enable-libstdcxx-backtrace
--with-libstdcxx-zoneinfo=/usr/share/zoneinfo --with-linker-hash-style=gnu
--enable-plugin --enable-initfini-array
--with-isl=/builddir/build/BUILD/gcc-14.1.1-20240701/obj-x86_64-redhat-linux/isl-install
--enable-offload-targets=nvptx-none,amdgcn-amdhsa --enable-offload-defaulted
--without-cuda-driver --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
--with-build-config=bootstrap-lto --enable-link-serialization=1