[Bug c++/107056] New: [11/12/13 Regression] ICE: unexpected expression '(unsigned int)((const char*)"")' of kind implicit_conv_expr

gscfq@t-online.de gcc-bugzilla@gcc.gnu.org
Tue Sep 27 16:24:13 GMT 2022


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

            Bug ID: 107056
           Summary: [11/12/13 Regression] ICE: unexpected expression
                    '(unsigned int)((const char*)"")' of kind
                    implicit_conv_expr
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started with r11 between 20201122 and 20201129,
test file derived from g++.dg/warn/Wunused-17.C :


$ cat z1.cc
int memory_consumption(const int &t) { return sizeof(t); }
int s;
int g() { return memory_consumption(s); }
template <int> struct X { static const int s = 2; };
template <typename T> int f() {
  const unsigned int dim = "";
  return X<dim>::s;
}
template int f<int>();
static int i;
template <typename> int h() { return i; }


$ gcc-13-20220925 -c z1.cc -Wfloat-conversion
z1.cc: In function 'int f()':
z1.cc:6:28: error: invalid conversion from 'const char*' to 'unsigned int'
[-fpermissive]
    6 |   const unsigned int dim = "";
      |                            ^~
      |                            |
      |                            const char*
z1.cc:7:15: internal compiler error: unexpected expression '(unsigned
int)((const char*)"")' of kind implicit_conv_expr
    7 |   return X<dim>::s;
      |               ^
0x85f8f6 cxx_eval_constant_expression
        ../../gcc/cp/constexpr.cc:7720
0x8615b3 cxx_eval_outermost_constant_expr
        ../../gcc/cp/constexpr.cc:7957
0x86662a maybe_constant_value(tree_node*, tree_node*, bool)
        ../../gcc/cp/constexpr.cc:8227
0x92a053 fold_for_warn(tree_node*)
        ../../gcc/cp/expr.cc:421
0xb66b65 unsafe_conversion_p(tree_node*, tree_node*, tree_node*, bool)
        ../../gcc/c-family/c-common.cc:1508
0xbeeef2 conversion_warning
        ../../gcc/c-family/c-warn.cc:1337
0x8a9f21 cp_convert_and_check(tree_node*, tree_node*, int)
        ../../gcc/cp/cvt.cc:680
0x810fcd convert_like_internal
        ../../gcc/cp/call.cc:8432
0x81fa07 convert_like
        ../../gcc/cp/call.cc:8501
0x81fa07 build_converted_constant_expr_internal
        ../../gcc/cp/call.cc:4625
0xa74471 convert_nontype_argument
        ../../gcc/cp/pt.cc:7428
0xa74471 convert_template_argument
        ../../gcc/cp/pt.cc:8710
0xa765a3 coerce_template_parms
        ../../gcc/cp/pt.cc:9189
0xa78d3b lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../../gcc/cp/pt.cc:10032
0xad471d finish_template_type(tree_node*, tree_node*, int)
        ../../gcc/cp/semantics.cc:3732
0xa0ecdc cp_parser_template_id
        ../../gcc/cp/parser.cc:18479
0xa0f23a cp_parser_class_name
        ../../gcc/cp/parser.cc:25937
0xa0223e cp_parser_qualifying_entity
        ../../gcc/cp/parser.cc:7201
0xa0223e cp_parser_nested_name_specifier_opt
        ../../gcc/cp/parser.cc:6883
0xa1c07c cp_parser_simple_type_specifier
        ../../gcc/cp/parser.cc:19917


More information about the Gcc-bugs mailing list