https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108582
Bug ID: 108582 Summary: ICE on valid code at -Os and above with "-fno-tree-ccp -fno-tree-dce": tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zhendong.su at inf dot ethz.ch Target Milestone: --- It appears to be a recent regression from 12.2. Compiler Explorer: https://godbolt.org/z/91oGh1W8K [617] % gcctk -v Using built-in specs. COLLECT_GCC=gcctk COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/13.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-trunk/configure --disable-bootstrap --enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk --enable-sanitizers --enable-languages=c,c++ --disable-werror --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.0.1 20230128 (experimental) [master r12-4647-g3f861a5c8fd] (GCC) [618] % [618] % gcctk -O3 small.c; ./a.out [619] % [619] % gcctk -O3 -fno-tree-ccp -fno-tree-dce small.c during GIMPLE pass: phiopt small.c: In function ‘main’: small.c:3:5: internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 3 | int main() { | ^~~~ 0x6e9981 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc-trunk/gcc/tree.cc:8959 0xbad6e3 tree_class_check(tree_node*, tree_code_class, char const*, int, char const*) ../../gcc-trunk/gcc/tree.h:3653 0xbad6e3 useless_type_conversion_p(tree_node*, tree_node*) ../../gcc-trunk/gcc/gimple-expr.cc:87 0xfb106c verify_gimple_assign_binary ../../gcc-trunk/gcc/tree-cfg.cc:4292 0xfc1897 verify_gimple_assign ../../gcc-trunk/gcc/tree-cfg.cc:4829 0xfc1897 verify_gimple_stmt ../../gcc-trunk/gcc/tree-cfg.cc:5088 0xfc9448 verify_gimple_in_cfg(function*, bool, bool) ../../gcc-trunk/gcc/tree-cfg.cc:5583 0xe5a333 execute_function_todo ../../gcc-trunk/gcc/passes.cc:2091 0xe5adb2 execute_todo ../../gcc-trunk/gcc/passes.cc:2145 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. [620] % [620] % cat small.c int a, c, d, e, f; char b; int main() { int g = 1; char h[1] = {0}; while (a) { if (f) { b = 0; if (d) continue; } if (a < 1) { g = 0; goto L; } } while (c) { char *j = h; int k; L: if (e && !g) k |= 2 | (*j < 0); } return 0; }