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

            Bug ID: 104184
           Summary: [11/12 Regression] ICE Error reporting routines
                    re-entered. xref_basetypes
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glisse at gcc dot gnu.org
  Target Milestone: ---

This is reduced from valid code (I think) and it still compiles with "g++ -c
-w" or "clang++ -c", although the undefined inline function seems to play a
strong role, so this may not be exactly the same as the original ICE. The call
stack starts the same (xref_basetypes) but in the original it went through
"unify" and only failed with gcc-12 (not 11) with -Wall and -Wextra.

template <long> using mp_size_t = int;
template <class...> struct mp_list;
template <class> struct mp_identity { using type = int; };
template <class... T> struct mp_inherit : T... {};
template <class T> using mpmf_wrap = mp_identity<T>;
template <class T> using mpmf_unwrap = typename T::type;
template <class, class> struct mp_map_find_impl;
template <template <class...> class M, class... T, class K> 
struct mp_map_find_impl<M<T...>, K> { 
  using U = mp_inherit<mpmf_wrap<T>...>;
  static mp_identity<void> f(mp_identity<int> *); 
  using type = mpmf_unwrap<decltype(f((U *)0))>;
};  
template <class M, class K> 
using mp_map_find = typename mp_map_find_impl<M, K>::type;
template <class> using mp_second = int;
template <class, int I> struct mp_at_c_impl { 
  using _map = mp_list<mp_list<>, int>;
  using type = mp_second<mp_map_find<_map, mp_size_t<I>>>;
};  
template <typename> using make_arg_list = mp_identity<void>;
template <typename Parameters, typename> struct argument_pack { 
  using type = typename mp_at_c_impl<
      typename make_arg_list<typename Parameters::parameter_spec>::type,
      0>::type;
}; 
struct parameters {
  typedef mp_list<> parameter_spec;
}; 
template <typename> 
using boost_param_result_39refine_mesh_3 = mp_identity<void>;
template <typename ParameterArgumentType0 = double> 
inline typename boost_param_result_39refine_mesh_3<
    typename argument_pack<parameters, ParameterArgumentType0>::type>::type
refine_mesh_3();
int main() { refine_mesh_3(); }

Internal compiler error: Error reporting routines re-entered.
0xec0348 xref_basetypes(tree_node*, tree_node*)
        ../../src/gcc/cp/decl.cc:15783
0x101d194 instantiate_class_template_1
        ../../src/gcc/cp/pt.cc:11953
0x101ec31 instantiate_class_template(tree_node*)
        ../../src/gcc/cp/pt.cc:12311
0x10714d8 complete_type(tree_node*)
        ../../src/gcc/cp/typeck.cc:143
0x102d168 lookup_base(tree_node*, tree_node*, int, base_kind*, int)
        ../../src/gcc/cp/search.cc:229
0xe0ea26 standard_conversion
        ../../src/gcc/cp/call.cc:1403
0xe12484 implicit_conversion_1
        ../../src/gcc/cp/call.cc:2031
0xe12484 implicit_conversion
        ../../src/gcc/cp/call.cc:2131
0xe13d7e add_function_candidate
        ../../src/gcc/cp/call.cc:2465
0xe15349 add_candidates
        ../../src/gcc/cp/call.cc:6182
0xe1c362 add_candidates
        ../../src/gcc/cp/call.cc:6051
0xe1c362 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ../../src/gcc/cp/call.cc:11012
0x1039e3d finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**,
bool, bool, int)
        ../../src/gcc/cp/semantics.cc:2788
0xfe96d4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../src/gcc/cp/pt.cc:20780
0xff5e8c tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.cc:16162
0x100494e tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.cc:13423
0xff635e tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.cc:15461
0x1005a77 tsubst_decl
        ../../src/gcc/cp/pt.cc:14815
0x101d842 instantiate_class_template_1
        ../../src/gcc/cp/pt.cc:12076
0x101ec31 instantiate_class_template(tree_node*)
        ../../src/gcc/cp/pt.cc:12311

Reply via email to