https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79414
Bug ID: 79414 Summary: internal compiler error after "error: expected unqualified-id at end of input" Product: gcc Version: 7.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jussi.judin at ericsson dot com Target Milestone: --- GCC 7.0.1 (git commit 7458afd6b35c4851d146f058435ba3dd6215db44) segmentation faults on following code after "error: expected unqualified-id at end of input". I encountered this while applying C-Reduce to another type of crash: class x0; template <x1> x2() { x0 x3 = x3. If I try to compile this with "gcc-bin/bin/g++ tst.cc" command, it will result in following output: tst.cc:2:11: error: ‘x1’ has not been declared template <x1> x2() { ^~ tst.cc:2:18: error: ISO C++ forbids declaration of ‘x2’ with no type [-fpermissive] template <x1> x2() { ^ tst.cc: In function ‘int x2()’: tst.cc:3:4: warning: ‘x3’ has incomplete type x0 x3 = x3. ^~ tst.cc:1:7: note: forward declaration of ‘class x0’ class x0; ^~ tst.cc:3:11: error: expected unqualified-id at end of input x0 x3 = x3. ^ tst.cc:3:11: internal compiler error: Segmentation fault 0xd27c4f crash_signal ../../gcc/gcc/toplev.c:333 0x60a355 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ../../gcc/gcc/cp/decl.c:6877 0x708c2c cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:19398 0x70947c cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:12792 0x70a235 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:12617 0x70ace9 cp_parser_declaration_statement ../../gcc/gcc/cp/parser.c:12227 0x6e59c3 cp_parser_statement ../../gcc/gcc/cp/parser.c:10714 0x6e6a5d cp_parser_statement_seq_opt ../../gcc/gcc/cp/parser.c:11046 0x6e6b2f cp_parser_compound_statement ../../gcc/gcc/cp/parser.c:11000 0x6fad43 cp_parser_function_body ../../gcc/gcc/cp/parser.c:21450 0x6fad43 cp_parser_ctor_initializer_opt_and_function_body ../../gcc/gcc/cp/parser.c:21488 0x7037a1 cp_parser_function_definition_after_declarator ../../gcc/gcc/cp/parser.c:26255 0x708fa0 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc/gcc/cp/parser.c:26167 0x708fa0 cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:19177 0x6e2a0a cp_parser_single_declaration ../../gcc/gcc/cp/parser.c:26713 0x702ddc cp_parser_template_declaration_after_parameters ../../gcc/gcc/cp/parser.c:26317 0x702a6c cp_parser_explicit_template_declaration ../../gcc/gcc/cp/parser.c:26552 0x702a6c cp_parser_template_declaration_after_export ../../gcc/gcc/cp/parser.c:26571 0x6e2ed9 cp_parser_declaration ../../gcc/gcc/cp/parser.c:12464 0x71369b cp_parser_declaration_seq_opt ../../gcc/gcc/cp/parser.c:12391 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. gcc -v gives following output on x86_64 Ubuntu 14.04 based system: Using built-in specs. COLLECT_GCC=/home/ejusjud/local/gcc-bin/bin/g++ COLLECT_LTO_WRAPPER=/local/ejusjud/gcc-bin/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --enable-languages=c,c++ --enable-libmpx --prefix=/home/ejusjud/local/gcc-bin : (reconfigured) ../gcc/configure --enable-languages=c,c++ --enable-libmpx --prefix=/home/ejusjud/local/gcc-bin : (reconfigured) ../gcc/configure --enable-languages=c,c++ --enable-libmpx --prefix=/home/ejusjud/local/gcc-bin : (reconfigured) ../gcc/configure --enable-languages=c,c++ --enable-libmpx --prefix=/home/ejusjud/local/gcc-bin : (reconfigured) ../gcc/configure --enable-languages=c,c++ --enable-libmpx --prefix=/home/ejusjud/local/gcc-bin : (reconfigured) ../gcc/configure --enable-languages=c,c++ --enable-libmpx --prefix=/home/ejusjud/local/gcc-bin : (reconfigured) ../gcc/configure --enable-languages=c,c++ --enable-libmpx --prefix=/home/ejusjud/local/gcc-bin : (reconfigured) ../gcc/configure --enable-languages=c,c++ --enable-libmpx --prefix=/home/ejusjud/local/gcc-bin Thread model: posix gcc version 7.0.1 20170207 (experimental) (GCC)