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

            Bug ID: 109597
           Summary: ICE: tree check: expected class ‘type’, have
                    ‘exceptional’ (error_mark) in
                    useless_type_conversion_p, at gimple-expr.c
           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: ---

gcc (GCC) 13.0.1 20230219 snapshot ICEs when compiling the following testcase

$ cat 1.c 

extern int x[4];

extern int y[4];

void foo(void)
{
  void bar(int [4]);
}

void bar(void [x]);

void baz(void)
{
  bar(y);
}

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

$ 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 1.c

error: declaration of type name as array of voids
   11 | void bar(void [x]);
      |               ^
1.c: In function ‘baz’:
1.c:15:7: error: type of formal parameter 1 is incomplete
   15 |   bar(y);
      |       ^
1.c:15:3: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.cc:259
   15 |   bar(y);
      |   ^~~
0x840637 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc-13-20230219/gcc/tree.cc:8959
0x77c162 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        ../../gcc-13-20230219/gcc/tree.h:3653
0x77c162 useless_type_conversion_p(tree_node*, tree_node*)
        ../../gcc-13-20230219/gcc/gimple-expr.cc:259
0xc8e710 types_compatible_p(tree_node*, tree_node*)
        ../../gcc-13-20230219/gcc/gimple-expr.h:67
0xc8e710 gimplify_addr_expr
        ../../gcc-13-20230219/gcc/gimplify.cc:6584
0xc8805d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-13-20230219/gcc/gimplify.cc:16408
0xc96b14 gimplify_call_expr
        ../../gcc-13-20230219/gcc/gimplify.cc:3711
0xc88500 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-13-20230219/gcc/gimplify.cc:16333
0xc8a316 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-13-20230219/gcc/gimplify.cc:7219
0xc8aa47 gimplify_bind_expr
        ../../gcc-13-20230219/gcc/gimplify.cc:1430
0xc87c95 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-13-20230219/gcc/gimplify.cc:16562
0xca912e gimplify_stmt(tree_node**, gimple**)
        ../../gcc-13-20230219/gcc/gimplify.cc:7219
0xca912e gimplify_body(tree_node*, bool)
        ../../gcc-13-20230219/gcc/gimplify.cc:17623
0xca958a gimplify_function_tree(tree_node*)
        ../../gcc-13-20230219/gcc/gimplify.cc:17822
0xad7fa7 cgraph_node::analyze()
        ../../gcc-13-20230219/gcc/cgraphunit.cc:676
0xadaaf7 analyze_functions
        ../../gcc-13-20230219/gcc/cgraphunit.cc:1238
0xadb78d symbol_table::finalize_compilation_unit()
        ../../gcc-13-20230219/gcc/cgraphunit.cc:2545
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