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

            Bug ID: 115986
           Summary: [14/15 Regression] ICE in fold_convert_loc, at
                    fold-const.cc:2644 involving user-defined uint128
                    literals
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: valentin at tolmer dot fr
  Target Milestone: ---

$ cat reduced.cpp
template <typename T>
constexpr int b(T) {
  return 0;
}
consteval __uint128_t operator"" _c(const char*) { return 0; }
constexpr char e() {
  long f = true ? 0 : b(long(1));
  return b(f);
}
template <typename>
void d() {
  0_c;
  static_assert(e());
}

$ g++ -std=c++2b -march=x86-64-v2 reduced.cpp
reduced.cpp: In function ‘void d()’:
reduced.cpp:12:3: internal compiler error: in fold_convert_loc, at
fold-const.cc:2633
   12 |   0_c;
      |   ^~~
0x6cca93 fold_convert_loc(unsigned int, tree_node*, tree_node*)
        /tmp/tmpihnyo_jq/gcc-14.1.0/gcc/fold-const.cc:2633
0x78c6ec cp_fold_convert(tree_node*, tree_node*)
        /tmp/tmpihnyo_jq/gcc-14.1.0/gcc/cp/cvt.cc:627
0x74b23d cxx_bind_parameters_in_call
        /tmp/tmpihnyo_jq/gcc-14.1.0/gcc/cp/constexpr.cc:1922
0x74b23d cxx_eval_call_expression
        /tmp/tmpihnyo_jq/gcc-14.1.0/gcc/cp/constexpr.cc:3044
0x742f7c cxx_eval_constant_expression
        /tmp/tmpihnyo_jq/gcc-14.1.0/gcc/cp/constexpr.cc:7559
0x75d7f5 cxx_eval_outermost_constant_expr
        /tmp/tmpihnyo_jq/gcc-14.1.0/gcc/cp/constexpr.cc:8857
0x77289f cxx_constant_value(tree_node*, tree_node*, int)
        /tmp/tmpihnyo_jq/gcc-14.1.0/gcc/cp/constexpr.cc:9013
0x77289f cxx_constant_value(tree_node*, int)
        /tmp/tmpihnyo_jq/gcc-14.1.0/gcc/cp/cp-tree.h:8686
0x77289f cp_fold_immediate_r
        /tmp/tmpihnyo_jq/gcc-14.1.0/gcc/cp/cp-gimplify.cc:1255
0x11e4d52 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
        /tmp/tmpihnyo_jq/gcc-14.1.0/gcc/tree.cc:11429
0x11e5173 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
        /tmp/tmpihnyo_jq/gcc-14.1.0/gcc/tree.cc:11545
0x11e4ada walk_tree_without_duplicates_1(tree_node**, tree_node*
(*)(tree_node**, int*, void*), void*, tree_node* (*)(tree_node**, int*,
tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false,
default_hash_traits<tree_node*> >*))
        /tmp/tmpihnyo_jq/gcc-14.1.0/gcc/tree.cc:11689
0x75a3d5 cp_fold_immediate(tree_node**, mce_value, tree_node*)
        /tmp/tmpihnyo_jq/gcc-14.1.0/gcc/cp/cp-gimplify.cc:517
0x75c336 process_and_check_pending_immediate_escalating_fns()
        /tmp/tmpihnyo_jq/gcc-14.1.0/gcc/cp/cp-gimplify.cc:1520
0x7c3d24 c_parse_final_cleanups()
        /tmp/tmpihnyo_jq/gcc-14.1.0/gcc/cp/decl2.cc:5403
0x9a6d14 c_common_parse_file()
        /tmp/tmpihnyo_jq/gcc-14.1.0/gcc/c-family/c-opts.cc:1329

Compilation works with 13.3, fails on 14.1 and trunk.

Reply via email to