https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82953
Bug ID: 82953 Summary: ICE in tree_check() ../../gcc/gcc/tree.h:3087 Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at inbox dot ru Target Milestone: --- Created attachment 42588 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42588&action=edit gcc-bug.ii Originally reported in https://bugs.gentoo.org/636646 Minimal SIGSEGV reproducer (not valid c++) is: class a; template <class> class b { static const b c; const int *m_fn1(); }; template <class d> const b<d> b<d>::c; template <class d> const int *b<d>::m_fn1() { c.a::e Crashes on gcc-7.2.0 and gcc-master as: LANG=C ./bin/g++ -c gcc-bug.ii gcc-bug.ii: In member function 'const int* b< <template-parameter-1-1> >::m_fn1()': gcc-bug.ii:8:8: internal compiler error: Segmentation fault c.a::e ^ 0xd937ef crash_signal ../../gcc/gcc/toplev.c:325 0x7fa1559ef03f ??? /usr/src/debug/sys-libs/glibc-2.26-r3/glibc-2.26/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0 0x7d66ad tree_check(tree_node*, char const*, int, char const*, tree_code) ../../gcc/gcc/tree.h:3087 0x7d66ad any_dependent_bases_p(tree_node*) ../../gcc/gcc/cp/search.c:2617 0x83ee52 finish_class_member_access_expr(cp_expr, tree_node*, bool, int) ../../gcc/gcc/cp/typeck.c:2848 0x733b98 cp_parser_postfix_dot_deref_expression ../../gcc/gcc/cp/parser.c:7693 0x740dde cp_parser_postfix_expression ../../gcc/gcc/cp/parser.c:7267 0x74472d cp_parser_unary_expression ../../gcc/gcc/cp/parser.c:8363 0x7214ac cp_parser_cast_expression ../../gcc/gcc/cp/parser.c:9131 0x721d47 cp_parser_binary_expression ../../gcc/gcc/cp/parser.c:9232 0x723864 cp_parser_assignment_expression ../../gcc/gcc/cp/parser.c:9519 0x7240d8 cp_parser_expression ../../gcc/gcc/cp/parser.c:9688 0x7262a8 cp_parser_expression_statement ../../gcc/gcc/cp/parser.c:11205 0x72d463 cp_parser_statement ../../gcc/gcc/cp/parser.c:11021 0x72e670 cp_parser_statement_seq_opt ../../gcc/gcc/cp/parser.c:11348 0x72e747 cp_parser_compound_statement ../../gcc/gcc/cp/parser.c:11302 0x748900 cp_parser_function_body ../../gcc/gcc/cp/parser.c:21837 0x748900 cp_parser_ctor_initializer_opt_and_function_body ../../gcc/gcc/cp/parser.c:21874 0x74a33a cp_parser_function_definition_after_declarator ../../gcc/gcc/cp/parser.c:26765 0x74b07d cp_parser_function_definition_from_specifiers_and_declarator ../../gcc/gcc/cp/parser.c:26681 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. gcc was built as: LANG=C ./bin/g++ -v Using built-in specs. COLLECT_GCC=./bin/g++ COLLECT_LTO_WRAPPER=/home/slyfox/dev/git/gcc-native-quick-installed/bin/../libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --enable-languages=c,c++ --disable-bootstrap --with-multilib-list=m64 --prefix=/home/slyfox/dev/git/gcc-native-quick/../gcc-native-quick-installed Thread model: posix gcc version 8.0.0 20171112 (experimental) (GCC)