Bug 103119

Summary: ICE in get_imports, at gimple-range-gori.cc:230
Product: gcc Reporter: Vsevolod Livinskii <vsevolod.livinskiy>
Component: tree-optimizationAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: babokin, marxin, regehr, vsevolod.livinskiy
Priority: P3 Keywords: ice-on-valid-code
Version: 12.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 103035    

Description Vsevolod Livinskii 2021-11-07 19:26:24 UTC
The bug is not reproducible on the trunk anymore (the reduction process took forever).
I don't know if it was fixed or became latent. Feel free to close it if it is not relevant anymore.

Reproducer:
unsigned short a;
bool b;
int h, f;
extern bool d[][1];
char g;
void i() {
  for (short c = 0; c < 10; c += 3)
    for (unsigned e = 0; e < a; e = (d[c][0] ? true : 5) * (6021496ULL * b) ?: f)
      h = g;
}

Error:
>$ g++ -O2 -c func.cpp
during GIMPLE pass: vrp
func.cpp: In function 'void i()':
func.cpp:6:6: internal compiler error: in get_imports, at gimple-range-gori.cc:230
    6 | void i() {
      |      ^
0x9e98e5 range_def_chain::get_imports(tree_node*)
        /testing/gcc/gcc_src_master/gcc/gimple-range-gori.cc:230
0x1edc480 range_def_chain::register_dependency(tree_node*, tree_node*, basic_block_def*)
        /testing/gcc/gcc_src_master/gcc/gimple-range-gori.cc:288
0x1edb976 range_def_chain::get_def_chain(tree_node*)
        /testing/gcc/gcc_src_master/gcc/gimple-range-gori.cc:383
0x1edbf98 range_def_chain::in_chain_p(tree_node*, tree_node*)
        /testing/gcc/gcc_src_master/gcc/gimple-range-gori.cc:198
0x1ede29b gori_compute::compute_operand_range(irange&, gimple*, irange const&, tree_node*, fur_source&)
        /testing/gcc/gcc_src_master/gcc/gimple-range-gori.cc:725
0x1edef21 gori_compute::compute_operand1_range(irange&, gimple*, irange const&, tree_node*, fur_source&)
        /testing/gcc/gcc_src_master/gcc/gimple-range-gori.cc:1078
0x1ede699 gori_compute::compute_operand_range(irange&, gimple*, irange const&, tree_node*, fur_source&)
        /testing/gcc/gcc_src_master/gcc/gimple-range-gori.cc:761
0x1edf989 gori_compute::outgoing_edge_range_p(irange&, edge_def*, tree_node*, range_query&)
        /testing/gcc/gcc_src_master/gcc/gimple-range-gori.cc:1259
0x1ed28c5 ranger_cache::range_on_edge(irange&, edge_def*, tree_node*)
        /testing/gcc/gcc_src_master/gcc/gimple-range-cache.cc:983
0x1ed2b69 ranger_cache::propagate_cache(tree_node*)
        /testing/gcc/gcc_src_master/gcc/gimple-range-cache.cc:1082
0x1ecdd9d gimple_ranger::range_of_stmt(irange&, gimple*, tree_node*)
        /testing/gcc/gcc_src_master/gcc/gimple-range.cc:280
0x15d1934 simplify_using_ranges::fold_cond(gcond*)
        /testing/gcc/gcc_src_master/gcc/vr-values.c:3492
0x15d1ea8 simplify_using_ranges::simplify_cond_using_ranges_1(gcond*)
        /testing/gcc/gcc_src_master/gcc/vr-values.c:3568
0x15d6f87 simplify_using_ranges::simplify(gimple_stmt_iterator*)
        /testing/gcc/gcc_src_master/gcc/vr-values.c:4386
0x154e3c8 rvrp_folder::fold_stmt(gimple_stmt_iterator*)
        /testing/gcc/gcc_src_master/gcc/tree-vrp.c:4324
0x14434d6 substitute_and_fold_dom_walker::before_dom_children(basic_block_def*)
        /testing/gcc/gcc_src_master/gcc/tree-ssa-propagate.c:870
0x1e9c847 dom_walker::walk(basic_block_def*)
        /testing/gcc/gcc_src_master/gcc/domwalk.c:309
0x1442689 substitute_and_fold_engine::substitute_and_fold(basic_block_def*)
        /testing/gcc/gcc_src_master/gcc/tree-ssa-propagate.c:987
0x15442c1 execute_ranger_vrp(function*, bool)
        /testing/gcc/gcc_src_master/gcc/tree-vrp.c:4349
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.

GCC version:
gcc version 12.0.0 20211105 (614b39757b8b61f70ac1c666edb7a01a5fc19cd4) (GCC)
Comment 1 Martin Liška 2021-11-08 08:21:48 UTC
Fixed with r12-4948-g1f6dd5de33912c26.

*** This bug has been marked as a duplicate of bug 103093 ***