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

            Bug ID: 115486
           Summary: ICE: Segfault while compiling partial template
                    specialization with expanded parameter pack of
                    function pointers
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sqsvp at ya dot ru
  Target Milestone: ---

Created attachment 58424
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58424&action=edit
preprocessed source

Segmentation fault while i try to compile partial template specialization
instantiated by pack of function pointers.

[ Minimal code required to reproduce ICE ]
struct s{

};

template <typename Value, typename... RetTypes, RetTypes... p(Value)>
struct s<p...>{
    s();
};

int f(int) { return 0; }

int main(){
    s<f>{};
}

[ How to reproduce ]
Just run g++ on preprocessed source
g++ a-main.ii

[ COMPILER OUTPUT + g++ -v output ]
Using built-in specs.
COLLECT_GCC=./gcc-pref/bin/g++
COLLECT_LTO_WRAPPER=/home/user/gcc-pref/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/user/gcc-pref
--enable-languages=c,c++ --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20240613 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic'
'-march=x86-64' '-dumpdir' 'a-'
 /home/user/gcc-pref/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/cc1plus -E -quiet
-v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE main.c -mtune=generic
-march=x86-64 -fpch-preprocess -o a-main.ii
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/home/user/gcc-pref/lib/gcc/x86_64-pc-linux-gnu/15.0.0/include-fixed/x86_64-linux-gnu"
ignoring nonexistent directory
"/home/user/gcc-pref/lib/gcc/x86_64-pc-linux-gnu/15.0.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:

/home/user/gcc-pref/lib/gcc/x86_64-pc-linux-gnu/15.0.0/../../../../include/c++/15.0.0

/home/user/gcc-pref/lib/gcc/x86_64-pc-linux-gnu/15.0.0/../../../../include/c++/15.0.0/x86_64-pc-linux-gnu

/home/user/gcc-pref/lib/gcc/x86_64-pc-linux-gnu/15.0.0/../../../../include/c++/15.0.0/backward
 /home/user/gcc-pref/lib/gcc/x86_64-pc-linux-gnu/15.0.0/include
 /usr/local/include
 /home/user/gcc-pref/include
 /home/user/gcc-pref/lib/gcc/x86_64-pc-linux-gnu/15.0.0/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic'
'-march=x86-64' '-dumpdir' 'a-'
 /home/user/gcc-pref/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/cc1plus
-fpreprocessed a-main.ii -quiet -dumpdir a- -dumpbase main.c -dumpbase-ext .c
-mtune=generic -march=x86-64 -version -o a-main.s
GNU C++17 (GCC) version 15.0.0 20240613 (experimental) (x86_64-pc-linux-gnu)
        compiled by GNU C version 15.0.0 20240613 (experimental), GMP version
6.3.0, MPFR version 4.2.1, MPC version 1.3.1, isl version none
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: b4aa700f7c742174da2ce3cbb5be788e
main.c:15:1: internal compiler error: Segmentation fault
   15 | }
      | ^
0x136f5ef crash_signal
        ../../gcc/toplev.cc:319
0xe442a4 tree_check(tree_node const*, char const*, int, char const*, tree_code)
        ../../gcc/tree.h:3919
0xe442a4 symbol_table::decl_assembler_name_hash(tree_node const*)
        ../../gcc/symtab.cc:84
0xe48370 symtab_node::get_for_asmname(tree_node const*)
        ../../gcc/symtab.cc:1067
0xe4848d symtab_node::verify_base()
        ../../gcc/symtab.cc:1158
0xe5920d cgraph_node::verify_node()
        ../../gcc/cgraph.cc:3495
0xe49014 symtab_node::verify()
        ../../gcc/symtab.cc:1362
0xe4a207 symtab_node::verify_symtab_nodes()
        ../../gcc/symtab.cc:1482
0xe60030 symtab_node::checking_verify_symtab_nodes()
        ../../gcc/cgraph.h:689
0xe60030 symbol_table::compile()
        ../../gcc/cgraphunit.cc:2318
0xe62d57 symbol_table::compile()
        ../../gcc/cgraphunit.cc:2315
0xe62d57 symbol_table::finalize_compilation_unit()
        ../../gcc/cgraphunit.cc:2589
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.

[ Where reproduces ]
I got this bug on trunk build of g++
Bug reproduces until gcc 8.1
there is no ICE on version 7.5 of gcc, just compilation error

Reply via email to