https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100532
Bug ID: 100532
Summary: ICE: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in
useless_type_conversion_p, at gimple-expr.c:259
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: cnsun at uwaterloo dot ca
Target Milestone: ---
Might be a duplicate of PR 100525.
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)
$ cat mutant.c
typedef __SIZE_TYPE__ size_t;
void *memcpy(void[], const void *, size_t);
c() { memcpy(c, "a", 2); }
$ gcc-trunk mutant.c
mutant.c:2:18: error: declaration of type name as array of voids
2 | void *memcpy(void[], const void *, size_t);
| ^
mutant.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
3 | c() { memcpy(c, "a", 2); }
| ^
mutant.c: In function ‘c’:
mutant.c:3:14: error: type of formal parameter 1 is incomplete
3 | c() { memcpy(c, "a", 2); }
| ^
mutant.c:3:7: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:259
3 | c() { memcpy(c, "a", 2); }
| ^~~~~~
0x7bce07 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.c:8724
0x6cb4a3 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.h:3479
0x6cb4a3 useless_type_conversion_p(tree_node*, tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-expr.c:259
0xc2fc77 types_compatible_p
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-expr.h:67
0xc2fc77 gimplify_addr_expr
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:6246
0xc25d93 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:14130
0xc34d59 gimplify_call_expr
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:3446
0xc25d73 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:14055
0xc28f6a gimplify_stmt(tree_node**, gimple**)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:6877
0xc2979e gimplify_bind_expr
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:1421
0xc259d3 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:14284
0xc28f6a gimplify_stmt(tree_node**, gimple**)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:6877
0xc2a563 gimplify_body(tree_node*, bool)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:15328
0xc2a9b1 gimplify_function_tree(tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:15482
0xa7e707 cgraph_node::analyze()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:670
0xa81611 analyze_functions
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:1234
0xa820e1 symbol_table::finalize_compilation_unit()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:2508
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.