https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115945
Bug ID: 115945 Summary: DW_LNE_set_discriminator emitted right before Special Opcodes 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 58672 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58672&action=edit small cpp code that reproduces the issue The issue: When generating line table entries for the attached program, GCC generates the following list of operations at some point (as printed by readelf): Copy (view 3) Set column to 18 Extended opcode 4: set Discriminator to 1 Special opcode 13: advance Address by 0 to 0x401133 and Line by 8 to 11 (view 4) However, per the DWARF 5 spec section 6.2.5.1, Special Opcodes always clobber the Discriminator register to be 0, so the extended opcode 4 is superfluous and, worse, the information is lost, making it harder to unwind the program. 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