https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124031
Bug ID: 124031
Summary: ICE: in force_decl_die, at dwarf2out.cc:27369 with -g
-femit-struct-debug-baseonly /
-femit-struct-debug-reduced
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Created attachment 63621
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63621&action=edit
reduced testcase
The testcase is very similar to PR116664 -- it seems the
-fno-emit-struct-debug-baseonly switch had the same effect as
-femit-struct-debug-baseonly.
Compiler output:
$ x86_64-pc-linux-gnu-g++ -g -femit-struct-debug-reduced ccc.ii
In file included from ccc.ii:
<stdin>: In function 'void foo()':
<stdin>:12:1: internal compiler error: in force_decl_die, at dwarf2out.cc:27369
0x3019bfd internal_error(char const*, ...)
/repo/gcc-trunk/gcc/diagnostic-global-context.cc:787
0xf21ed3 fancy_abort(char const*, int, char const*)
/repo/gcc-trunk/gcc/diagnostics/context.cc:1812
0x8be984 force_decl_die
/repo/gcc-trunk/gcc/dwarf2out.cc:27369
0x146015d force_decl_die
/repo/gcc-trunk/gcc/dwarf2out.cc:27320
0x146015d dwarf2out_imported_module_or_decl_1
/repo/gcc-trunk/gcc/dwarf2out.cc:28017
0x147ff5f decls_for_scope
/repo/gcc-trunk/gcc/dwarf2out.cc:27188
0x145c3b5 gen_subprogram_die
/repo/gcc-trunk/gcc/dwarf2out.cc:24596
0x146103a gen_decl_die
/repo/gcc-trunk/gcc/dwarf2out.cc:27626
0x1462428 dwarf2out_decl
/repo/gcc-trunk/gcc/dwarf2out.cc:28226
0x14628ce dwarf2out_early_global_decl
/repo/gcc-trunk/gcc/dwarf2out.cc:27851
0x12bf6bc c_common_finalize_early_debug()
/repo/gcc-trunk/gcc/c-family/c-common.cc:10551
0x13d744e symbol_table::finalize_compilation_unit()
/repo/gcc-trunk/gcc/cgraphunit.cc:2614
/repo/gcc-trunk/binary-trunk-20260208085915-r16-7394-gd93c8a679b2657-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/16.0.1/cc1plus
-fpreprocessed ccc.ii -quiet -dumpdir a- -dumpbase ccc.ii -dumpbase-ext .ii
-mtune=generic -march=x86-64 -g -femit-struct-debug-reduced -o /tmp/ccBpgWF4.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ x86_64-pc-linux-gnu-g++ -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest/bin/x86_64-pc-linux-gnu-g++
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-20260208085915-r16-7394-gd93c8a679b2657-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/16.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --enable-libsanitizer
--disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-20260208085915-r16-7394-gd93c8a679b2657-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.1 20260208 (experimental) (GCC)