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

            Bug ID: 109618
           Summary: ICE: tree check: expected class ‘type’, have
                    ‘exceptional’ (error_mark) in
                    generic_simplify_CONVERT_EXPR, at generic-match.cc
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anbu1024.me at gmail dot com
  Target Milestone: ---

$ cat test.c 

int foo()
{
  const unsigned int var_1 = 2;

  char var_5[var_1];

  int var_1[10];

  return sizeof(var_5);
}


--------------------------------

$ gcc --version
gcc (GCC) 13.0.1 20230219 (experimental)
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

--------------------------------

$ gcc test.c  
test.c: In function ‘foo’:
test.c:8:7: error: conflicting type qualifiers for ‘var_1’
    8 |   int var_1[10];
      |       ^~~~~
test.c:4:22: note: previous definition of ‘var_1’ with type ‘unsigned int’
    4 |   const unsigned int var_1 = 2;
      |                      ^~~~~
test.c :10:3: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in generic_simplify_CONVERT_EXPR, at
generic-match.cc:28499
   10 |   return sizeof(var_5);
      |   ^~~~~~
0x840637 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc-13-20230219/gcc/tree.cc:8959
0x8abac0 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        ../../gcc-13-20230219/gcc/tree.h:3653
0x8abac0 generic_simplify_CONVERT_EXPR
        gcc-13-20230219-build/gcc/generic-match.cc:28499
0xbf6848 fold_unary_loc(unsigned int, tree_code, tree_node*, tree_node*)
        ../../gcc-13-20230219/gcc/fold-const.cc:9341
0xbf8079 fold_build1_loc(unsigned int, tree_code, tree_node*, tree_node*)
        ../../gcc-13-20230219/gcc/fold-const.cc:13778
0x9429bb c_expr_sizeof_expr(unsigned int, c_expr)
        ../../gcc-13-20230219/gcc/c/c-typeck.cc:3096
0x97ef46 c_parser_sizeof_expression
        ../../gcc-13-20230219/gcc/c/c-parser.cc:8910
0x97ef46 c_parser_unary_expression
        ../../gcc-13-20230219/gcc/c/c-parser.cc:8803
0x97fdef c_parser_cast_expression
        ../../gcc-13-20230219/gcc/c/c-parser.cc:8672
0x9800df c_parser_binary_expression
        ../../gcc-13-20230219/gcc/c/c-parser.cc:8440
0x98154b c_parser_conditional_expression
        ../../gcc-13-20230219/gcc/c/c-parser.cc:8138
0x981d24 c_parser_expr_no_commas
        ../../gcc-13-20230219/gcc/c/c-parser.cc:8052
0x981fd1 c_parser_expression
        ../../gcc-13-20230219/gcc/c/c-parser.cc:11379
0x982717 c_parser_expression_conv
        ../../gcc-13-20230219/gcc/c/c-parser.cc:11419
0x97858b c_parser_statement_after_labels
        ../../gcc-13-20230219/gcc/c/c-parser.cc:6674
0x9798e4 c_parser_compound_statement_nostart
        ../../gcc-13-20230219/gcc/c/c-parser.cc:6296
0x99f164 c_parser_compound_statement
        ../../gcc-13-20230219/gcc/c/c-parser.cc:6105
0x9a10cb c_parser_declaration_or_fndef
        ../../gcc-13-20230219/gcc/c/c-parser.cc:2841
0x9a8a1b c_parser_external_declaration
        ../../gcc-13-20230219/gcc/c/c-parser.cc:1925
0x9a93f3 c_parser_translation_unit
        ../../gcc-13-20230219/gcc/c/c-parser.cc:1779
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