https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103596
Bug ID: 103596
Summary: [11/12 Regression] ICE: tree check: expected class
'type', have 'exceptional' (error_mark) in
useless_type_conversion_p, at gimple-expr.c:88
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: asolokha at gmx dot com
Target Milestone: ---
gcc 12.0.0 20211205 snapshot (g:c9419faef0bfaf31e6a6f744baa064892e0d105c) ICEs
when compiling the following testcase w/ -O3 --param case-values-threshold=1:
int n;
void
qux (int a)
{
}
int
baz (void)
{
return -1;
}
__attribute__ ((returns_twice)) int
bar (int b)
{
if (n != 0)
{
if (b != 2)
if (b != 0)
return n + b;
if (n == 2)
return 0;
}
}
void
foo (void)
{
qux (n);
bar (baz ());
}
% gcc-12.0.0 -O3 --param case-values-threshold=1 -c ubzlb8tx.c
during GIMPLE pass: fre
ubzlb8tx.c: In function 'foo':
ubzlb8tx.c:33:1: internal compiler error: tree check: expected class 'type',
have 'exceptional' (error_mark) in useless_type_conversion_p, at
gimple-expr.c:88
33 | }
| ^
0x78363b tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211205/work/gcc-12-20211205/gcc/tree.c:8752
0x6b6df4 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211205/work/gcc-12-20211205/gcc/tree.h:3564
0x6b6df4 useless_type_conversion_p(tree_node*, tree_node*)
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211205/work/gcc-12-20211205/gcc/gimple-expr.c:88
0xee4e5a verify_gimple_comparison
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211205/work/gcc-12-20211205/gcc/tree-cfg.c:3550
0xef9fe9 verify_gimple_in_cfg(function*, bool)
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211205/work/gcc-12-20211205/gcc/tree-cfg.c:5514
0xdbbecf execute_function_todo
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211205/work/gcc-12-20211205/gcc/passes.c:2084
0xdbc40c execute_todo
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211205/work/gcc-12-20211205/gcc/passes.c:2138