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

            Bug ID: 87847
           Summary: spec_hasher::hash does not match with
                    spec_hasher::equal
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: jason at gcc dot gnu.org, mpolacek at gcc dot gnu.org,
                    nathan at gcc dot gnu.org
  Target Milestone: ---

Created attachment 44941
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44941&action=edit
patch to trigger the problem

As mentioned in following sub-thread:
https://gcc.gnu.org/ml/gcc-patches/2018-10/msg01885.html

There's violation of hash table in type_specializations hash table.
Attached patch exposes that.

$ ./xg++ -B. /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/template/ttp23.C
-c
/home/marxin/Programming/gcc/gcc/testsuite/g++.dg/template/ttp23.C: In
instantiation of ‘struct B<A>’:
/home/marxin/Programming/gcc/gcc/testsuite/g++.dg/template/ttp23.C:15:8:  
required from here
/home/marxin/Programming/gcc/gcc/testsuite/g++.dg/template/ttp23.C:8:17:
internal compiler error: in equal, at cp/pt.c:1699
    8 |     friend bool foo (const B<Q>& a);
      |                 ^~~
0x9c1b40 spec_hasher::equal(spec_entry*, spec_entry*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:1698
0xa48639 hash_table<spec_hasher, xcallocator>::find_with_hash(spec_entry*
const&, unsigned int)
        /home/marxin/Programming/gcc/gcc/hash-table.h:863
0x9e51f7 lookup_template_class_1
        /home/marxin/Programming/gcc/gcc/cp/pt.c:9353
0x9e785d lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:9680
0x9f46a4 tsubst_aggr_type
        /home/marxin/Programming/gcc/gcc/cp/pt.c:12685
0x9ff5ac tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:14333
0x9ff527 tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:14324
0x9fdb8b tsubst_arg_types
        /home/marxin/Programming/gcc/gcc/cp/pt.c:13930
0x9fe22e tsubst_function_type
        /home/marxin/Programming/gcc/gcc/cp/pt.c:14071
0xa018c3 tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:14808
0x9f5dd1 tsubst_function_decl
        /home/marxin/Programming/gcc/gcc/cp/pt.c:12949
0x9f927f tsubst_template_decl
        /home/marxin/Programming/gcc/gcc/cp/pt.c:13253
0x9fa86b tsubst_decl
        /home/marxin/Programming/gcc/gcc/cp/pt.c:13355
0x9febb7 tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:14251
0x9e9f42 tsubst_friend_function
        /home/marxin/Programming/gcc/gcc/cp/pt.c:10316
0x9ef597 instantiate_class_template_1
        /home/marxin/Programming/gcc/gcc/cp/pt.c:11365
0x9ef816 instantiate_class_template(tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:11430
0xa90c52 complete_type(tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/typeck.c:138
0x8ea857 start_decl_1(tree_node*, bool)
        /home/marxin/Programming/gcc/gcc/cp/decl.c:5278
0x91285f start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        /home/marxin/Programming/gcc/gcc/cp/decl.c:5241

Reply via email to