https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116112
Bug ID: 116112 Summary: ICE: in add_dwarf_attr, at dwarf2out.cc:4515 Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: iamanonymous.cs at gmail dot com Target Milestone: --- Target: x86_64 ******************************************************************************* The compiler produces a ICE during add_dwarf_attr when compiling the provided code with the specified options. The issue can also be reproduced on Compiler Explorer. ******************************************************************************* OS and Platform: # uname -a Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux ******************************************************************************* # gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/home/gcc-set/gcc24-7-24/gccbin/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /home/gcc-set/gcc24-7-24/configure --prefix=/home/gcc-set/gcc24-7-24/gccbin --enable-languages=c,c++,fortran,go --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 15.0.0 20240724 (experimental) (GCC) ******************************************************************************* Program: #cat 1.c int __seg_gs m; int foo (void) { return m; } ******************************************************************************* Command Lines: #gcc 1.c -fprofile-arcs -ftest-coverage -O3 -fno-omit-frame-pointer -g -ftrapv -fno-stack-protector -ffunction-sections -fdata-sections -fno-strict-aliasing -Wall -Wextra -Werror -fno-optimize-sibling-calls -fno-unsafe-math-optimizations -DDEBUG -DNDEBUG -o 1 1.c:1:1: internal compiler error: in add_dwarf_attr, at dwarf2out.cc:4515 1 | int __seg_gs m; | ^~~ 0x24d6e6e internal_error(char const*, ...) /home/gcc-set/gcc24-7-24/gcc/diagnostic-global-context.cc:491 0x9be1b9 fancy_abort(char const*, int, char const*) /home/gcc-set/gcc24-7-24/gcc/diagnostic.cc:1725 0x7d4cc6 add_dwarf_attr /home/gcc-set/gcc24-7-24/gcc/dwarf2out.cc:4515 0x7d62bf add_dwarf_attr /home/gcc-set/gcc24-7-24/gcc/hash-table.h:769 0x7d62bf add_AT_string /home/gcc-set/gcc24-7-24/gcc/dwarf2out.cc:4787 0x7d62bf add_name_attribute(die_struct*, char const*) /home/gcc-set/gcc24-7-24/gcc/dwarf2out.cc:21323 0x7d62bf add_name_attribute(die_struct*, char const*) /home/gcc-set/gcc24-7-24/gcc/dwarf2out.cc:21316 0xc4cd81 modified_type_die /home/gcc-set/gcc24-7-24/gcc/dwarf2out.cc:14081 0xc4e0ab add_type_attribute /home/gcc-set/gcc24-7-24/gcc/dwarf2out.cc:22447 0xc616b2 gen_variable_die /home/gcc-set/gcc24-7-24/gcc/dwarf2out.cc:24785 0xc46814 gen_decl_die /home/gcc-set/gcc24-7-24/gcc/dwarf2out.cc:27281 0xc48248 dwarf2out_decl /home/gcc-set/gcc24-7-24/gcc/dwarf2out.cc:27774 0xc48558 dwarf2out_early_global_decl /home/gcc-set/gcc24-7-24/gcc/dwarf2out.cc:27421 0x9f8d88 finish_decl(tree_node*, unsigned int, tree_node*, tree_node*, tree_node*) /home/gcc-set/gcc24-7-24/gcc/c/c-decl.cc:5994 0xa6a1a2 c_parser_declaration_or_fndef /home/gcc-set/gcc24-7-24/gcc/c/c-parser.cc:2855 0xa75c9b c_parser_external_declaration /home/gcc-set/gcc24-7-24/gcc/c/c-parser.cc:2060 0xa766dd c_parser_translation_unit /home/gcc-set/gcc24-7-24/gcc/c/c-parser.cc:1914 0xa766dd c_parse_file() /home/gcc-set/gcc24-7-24/gcc/c/c-parser.cc:27336 0xaf24b1 c_common_parse_file() /home/gcc-set/gcc24-7-24/gcc/c-family/c-opts.cc:1315 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. ******************************************************************************* Also ICE on trunk, compiler explorer:https://godbolt.org/z/z45q4TKf3 *******************************************************************************