https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108639
Bug ID: 108639 Summary: ICE on valid code at -O1 and above: in decompose, at wide-int.h:984 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. Compiler Explorer: https://godbolt.org/z/aE6Tssrq6 [538] % 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 --enable-multilib --with-system-zlib Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.0.1 20230202 (experimental) [master r13-5642-g66d700af5bb] (GCC) [539] % [539] % gcctk -O1 small.c small.c: In function ‘main’: small.c:3:18: warning: division by zero [-Wdiv-by-zero] 3 | a = a ? 0 || 0 % 0 : 0; | ^ during GIMPLE pass: dom small.c:2:5: internal compiler error: in decompose, at wide-int.h:984 2 | int main() { | ^~~~ 0x7b6a92 wi::int_traits<generic_wide_int<wide_int_ref_storage<false, false> > >::decompose(long*, unsigned int, generic_wide_int<wide_int_ref_storage<false, false> > const&) ../../gcc-trunk/gcc/wide-int.h:984 0x7b7838 wi::int_traits<generic_wide_int<wide_int_storage> >::decompose(long*, unsigned int, generic_wide_int<wide_int_storage> const&) ../../gcc-trunk/gcc/value-range.h:940 0x7b7838 wide_int_ref_storage<true, false>::wide_int_ref_storage<generic_wide_int<wide_int_storage> >(generic_wide_int<wide_int_storage> const&, unsigned int) ../../gcc-trunk/gcc/wide-int.h:1034 0x7b7838 generic_wide_int<wide_int_ref_storage<true, false> >::generic_wide_int<generic_wide_int<wide_int_storage> >(generic_wide_int<wide_int_storage> const&, unsigned int) ../../gcc-trunk/gcc/wide-int.h:790 0x7b7838 bool wi::eq_p<generic_wide_int<wide_int_storage>, generic_wide_int<wide_int_storage> >(generic_wide_int<wide_int_storage> const&, generic_wide_int<wide_int_storage> const&) ../../gcc-trunk/gcc/wide-int.h:1873 0x7b7838 wi::binary_traits<generic_wide_int<wide_int_storage>, generic_wide_int<wide_int_storage>, wi::int_traits<generic_wide_int<wide_int_storage> >::precision_type, wi::int_traits<generic_wide_int<wide_int_storage> >::precision_type>::predicate_result operator==<generic_wide_int<wide_int_storage>, generic_wide_int<wide_int_storage> >(generic_wide_int<wide_int_storage> const&, generic_wide_int<wide_int_storage> const&) ../../gcc-trunk/gcc/wide-int.h:3307 0x7b7838 irange::operator==(irange const&) const ../../gcc-trunk/gcc/value-range.cc:1297 0x7b7838 irange::operator==(irange const&) const ../../gcc-trunk/gcc/value-range.cc:1266 0x1e4fc26 range_operator::fold_range(irange&, tree_node*, irange const&, irange const&, relation_trio) const ../../gcc-trunk/gcc/range-op.cc:271 0x1e5030c operator_lshift::fold_range(irange&, tree_node*, irange const&, irange const&, relation_trio) const ../../gcc-trunk/gcc/range-op.cc:2246 0x1d4db80 fold_using_range::range_of_range_op(vrange&, gimple_range_op_handler&, fur_source&) ../../gcc-trunk/gcc/gimple-range-fold.cc:589 0x1d4f56a fold_using_range::fold_stmt(vrange&, gimple*, fur_source&, tree_node*) ../../gcc-trunk/gcc/gimple-range-fold.cc:489 0x1d40d7c gimple_ranger::fold_range_internal(vrange&, gimple*, tree_node*) ../../gcc-trunk/gcc/gimple-range.cc:257 0x1d40d7c gimple_ranger::range_of_stmt(vrange&, gimple*, tree_node*) ../../gcc-trunk/gcc/gimple-range.cc:318 0x1d42ac0 gimple_ranger::range_of_expr(vrange&, tree_node*, gimple*) ../../gcc-trunk/gcc/gimple-range.cc:126 0x1028acf cprop_operand ../../gcc-trunk/gcc/tree-ssa-dom.cc:1972 0x102a969 cprop_into_stmt ../../gcc-trunk/gcc/tree-ssa-dom.cc:2049 0x102a969 dom_opt_dom_walker::optimize_stmt(basic_block_def*, gimple_stmt_iterator*, bool*) ../../gcc-trunk/gcc/tree-ssa-dom.cc:2277 0x102bd13 dom_opt_dom_walker::before_dom_children(basic_block_def*) ../../gcc-trunk/gcc/tree-ssa-dom.cc:1682 0x1d0a0f7 dom_walker::walk(basic_block_def*) ../../gcc-trunk/gcc/domwalk.cc:311 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. [540] % [540] % cat small.c long a; int main() { a = a ? 0 || 0 % 0 : 0; a = a << a; return 0; }