https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121181

            Bug ID: 121181
           Summary: ICE on x86_64-linux-gnu: in set_fini_priority, at
                    symtab.cc:1903 with destructor
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jiangchangwu at smail dot nju.edu.cn
  Target Milestone: ---

Compiler Explorer: https://gcc.godbolt.org/z/4b4zYzf47

*******************************************************************************
gcc version:
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --disable-multilib --disable-bootstrap
--enable-languages=c,c++ --prefix=/home/software/gcc-trunk --enable-coverage
--disable-werror --enable-checking=yes
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 16.0.0 20250613 (experimental) (GCC)

*******************************************************************************
Program:
$ cat mutant.c
__attribute__((destructor)) static __attribute__((destructor(3))) a()

*******************************************************************************
Command Lines:
$ gcc mutant.c
mutant.c:1:1: warning: destructor priorities from 0 to 100 are reserved for the
implementation [-Wprio-ctor-dtor]
    1 | __attribute__((destructor)) static __attribute__((destructor(3))) a()
      | ^~~~~~~~~~~~~
mutant.c:1:1: internal compiler error: in set_fini_priority, at symtab.cc:1903
0x5554b38 internal_error(char const*, ...)
        ../../gcc/gcc/diagnostic-global-context.cc:517
0x54d2d0a fancy_abort(char const*, int, char const*)
        ../../gcc/gcc/diagnostic.cc:1803
0x13ebd85 cgraph_node::set_fini_priority(unsigned short)
        ../../gcc/gcc/symtab.cc:1903
0x294c12d decl_fini_priority_insert(tree_node*, unsigned short)
        ../../gcc/gcc/tree.cc:5991
0x122871a handle_destructor_attribute
        ../../gcc/gcc/c-family/c-attribs.cc:2321
0xebdce9 decl_attributes(tree_node**, tree_node*, int, tree_node*)
        ../../gcc/gcc/attribs.cc:904
0xef0914 c_decl_attributes
        ../../gcc/gcc/c/c-decl.cc:5564
0xf12ec8 start_function(c_declspecs*, c_declarator*, tree_node*)
        ../../gcc/gcc/c/c-decl.cc:10655
0xffa60c c_parser_declaration_or_fndef
        ../../gcc/gcc/c/c-parser.cc:3117
0xff59fd c_parser_external_declaration
        ../../gcc/gcc/c/c-parser.cc:2155
0xff4ea2 c_parser_translation_unit
        ../../gcc/gcc/c/c-parser.cc:2009
0x10a17ee c_parse_file()
        ../../gcc/gcc/c/c-parser.cc:30153
0x11d7aeb c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.cc:1385
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.

Reply via email to