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

--- Comment #5 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
I think I found something similar on openttd-12.1. Seems to be a mostly gcc-12
regression:

$ cat bug.cpp
template <typename T> using t = T;
template <typename...> struct s;
template <typename... Args> s<t<Args>...> f() { f<void>(); }

$ g++-12.0.0 --param=hash-table-verification-limit=1000 -O1 -o a.o -c bug.cpp

hash table checking failed: equal operator returns true for a pair of values
with a different hash value
bug.cpp: In substitution of 'template<class ... Args> s<Args ...> f() [with
Args = {void}]':
bug.cpp:3:56:   required from here
bug.cpp:3:43: internal compiler error: in hashtab_chk_error, at
hash-table.c:137
    3 | template <typename... Args> s<t<Args>...> f() { f<void>(); }
      |                                           ^
0x9c316d hashtab_chk_error()
        ../../gcc-12-20220102/gcc/hash-table.c:137
0xbeca15 hash_table<spec_hasher, false, xcallocator>::verify(spec_entry*
const&, unsigned int)
        ../../gcc-12-20220102/gcc/hash-table.h:1036
0xbecb6f hash_table<spec_hasher, false,
xcallocator>::find_with_hash(spec_entry* const&, unsigned int)
        ../../gcc-12-20220102/gcc/hash-table.h:921
0xbd58bc lookup_template_class_1
        ../../gcc-12-20220102/gcc/cp/pt.c:9905
0xbd7e06 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../../gcc-12-20220102/gcc/cp/pt.c:10260
0xbd7e06 tsubst_aggr_type
        ../../gcc-12-20220102/gcc/cp/pt.c:13642
0xbcdf6a tsubst_function_type
        ../../gcc-12-20220102/gcc/cp/pt.c:15154
0xbbffcd tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-12-20220102/gcc/cp/pt.c:15970
0xbe40f9 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
        ../../gcc-12-20220102/gcc/cp/pt.c:21857
0x9e1529 add_template_candidate_real
        ../../gcc-12-20220102/gcc/cp/call.c:3544
0x9e2473 add_template_candidate
        ../../gcc-12-20220102/gcc/cp/call.c:3632
0x9e2473 add_candidates
        ../../gcc-12-20220102/gcc/cp/call.c:6165
0x9e8849 add_candidates
        ../../gcc-12-20220102/gcc/cp/call.c:4692
0x9e8849 perform_overload_resolution
        ../../gcc-12-20220102/gcc/cp/call.c:4709
0x9ed682 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ../../gcc-12-20220102/gcc/cp/call.c:4816
0xc03d31 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ../../gcc-12-20220102/gcc/cp/semantics.c:2865
0xb64f91 cp_parser_postfix_expression
        ../../gcc-12-20220102/gcc/cp/parser.c:7821
0xb4d49a cp_parser_binary_expression
        ../../gcc-12-20220102/gcc/cp/parser.c:9984
0xb4dfbe cp_parser_assignment_expression
        ../../gcc-12-20220102/gcc/cp/parser.c:10288
0xb4fae9 cp_parser_expression
        ../../gcc-12-20220102/gcc/cp/parser.c:10458
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.

$ g++-12.0.0 -v
Using built-in specs.
COLLECT_GCC=/nix/store/9s988q1yj67hk7d2v7wxl961h2d34mgg-gcc-debug-12.0.0/bin/g++
COLLECT_LTO_WRAPPER=/nix/store/9s988q1yj67hk7d2v7wxl961h2d34mgg-gcc-debug-12.0.0/libexec/gcc/x86_64-unknown-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20220102 (experimental) (GCC)

Reply via email to