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

            Bug ID: 120770
           Summary: ICE: in verify_ctor_sanity, at cp/constexpr.cc:5454
                    with '-fcontracts'
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rush102333 at gmail dot com
  Target Milestone: ---

Start to crash since gcc-14: https://godbolt.org/z/xoM8dqzj1

Simplified test:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

template<typename T>
auto fn()
  [[ pre: T{} ]]
{
}


int main(int, char**) {
  fn<int>();
  return 0;
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


$g++ -fcontracts test.cpp

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

<source>: In instantiation of 'auto fn() [with T = int]':
<source>:9:10:   required from here
    9 |   fn<int>();
      |   ~~~~~~~^~
<source>:5:1: internal compiler error: in verify_ctor_sanity, at
cp/constexpr.cc:5454
    5 | }
      | ^
0x2828ff5 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x284a786 internal_error(char const*, ...)
        ???:0
0xae0b00 fancy_abort(char const*, int, char const*)
        ???:0
0xb5dbb1 maybe_constant_value(tree_node*, tree_node*, mce_value)
        ???:0
0xdd9b97 cp_build_binary_op(op_location_t const&, tree_code, tree_node*,
tree_node*, int)
        ???:0
0xdddbc2 build_binary_op(unsigned long, tree_code, tree_node*, tree_node*,
bool)
        ???:0
0xb92141 cp_convert_and_check(tree_node*, tree_node*, int)
        ???:0
0xb0ce53 perform_implicit_conversion_flags(tree_node*, tree_node*, int, int)
        ???:0
0xdd7176 cp_build_unary_op(tree_code, tree_node*, bool, int)
        ???:0
0xb1b596 build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, int)
        ???:0
0xdd5a94 build_x_unary_op(unsigned long, tree_code, cp_expr, tree_node*, int)
        ???:0
0xb97535 build_contract_check(tree_node*)
        ???:0
0x183fbac 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*> >*))
        ???:0
0xb82688 cp_genericize(tree_node*)
        ???:0
0xbd2c60 finish_function(bool)
        ???:0
0xb9b73a finish_function_contracts(tree_node*)
        ???:0
0xbd1f11 finish_function(bool)
        ???:0
0xd6018d instantiate_decl(tree_node*, bool, bool)
        ???:0
0xbe9b83 maybe_instantiate_decl(tree_node*)
        ???:0
0xbeb8f7 mark_used(tree_node*, int)
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to