https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112827

--- Comment #2 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
Another test that reproduces at -O1 and above.

[520] % gcctk -O3 small.c
during GIMPLE pass: sccp
small.c: In function ‘main’:
small.c:4:5: internal compiler error: Segmentation fault
    4 | int main() {
      |     ^~~~
0x105e613 crash_signal
        ../../gcc-trunk/gcc/toplev.cc:316
0x1149882 gimple_bb(gimple const*)
        ../../gcc-trunk/gcc/gimple.h:1908
0x1149882 instantiate_scev_name
        ../../gcc-trunk/gcc/tree-scalar-evolution.cc:2263
0x1149882 instantiate_scev_r
        ../../gcc-trunk/gcc/tree-scalar-evolution.cc:2637
0x114977d instantiate_scev_poly
        ../../gcc-trunk/gcc/tree-scalar-evolution.cc:2410
0x114977d instantiate_scev_r
        ../../gcc-trunk/gcc/tree-scalar-evolution.cc:2642
0x114a1de instantiate_scev(edge_def*, loop*, tree_node*)
        ../../gcc-trunk/gcc/tree-scalar-evolution.cc:2719
0x12027c5 instantiate_parameters(loop*, tree_node*)
        ../../gcc-trunk/gcc/tree-scalar-evolution.h:64
0x12027c5 idx_infer_loop_bounds
        ../../gcc-trunk/gcc/tree-ssa-loop-niter.cc:4154
0x1217343 for_each_index(tree_node**, bool (*)(tree_node*, tree_node**, void*),
void*)
        ../../gcc-trunk/gcc/tree-ssa-loop.cc:571
0x11ffa7d infer_loop_bounds_from_ref
        ../../gcc-trunk/gcc/tree-ssa-loop-niter.cc:4230
0x11ffa7d infer_loop_bounds_from_array
        ../../gcc-trunk/gcc/tree-ssa-loop-niter.cc:4251
0x11ffa7d infer_loop_bounds_from_undefined
        ../../gcc-trunk/gcc/tree-ssa-loop-niter.cc:4408
0x11ffa7d estimate_numbers_of_iterations(loop*)
        ../../gcc-trunk/gcc/tree-ssa-loop-niter.cc:4866
0x1201caf loop_exits_before_overflow
        ../../gcc-trunk/gcc/tree-ssa-loop-niter.cc:5253
0x1201caf scev_probably_wraps_p(tree_node*, tree_node*, tree_node*, gimple*,
loop*, bool)
        ../../gcc-trunk/gcc/tree-ssa-loop-niter.cc:5505
0x1201caf scev_probably_wraps_p(tree_node*, tree_node*, tree_node*, gimple*,
loop*, bool)
        ../../gcc-trunk/gcc/tree-ssa-loop-niter.cc:5463
0x2033067 convert_affine_scev(loop*, tree_node*, tree_node**, tree_node**,
gimple*, bool, tree_node*)
        ../../gcc-trunk/gcc/tree-chrec.cc:1425
0x2032abe chrec_convert_1
        ../../gcc-trunk/gcc/tree-chrec.cc:1483
0x114a923 scev_dfs::follow_ssa_edge_expr(gimple*, tree_node*, tree_node**, int)
        ../../gcc-trunk/gcc/tree-scalar-evolution.cc:1238
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.
[521] % 
[521] % cat small.c
short a, b[1], f;
char c, g;
int d, e;
int main() {
  for (; f; f++) {
    for (d = 0; d < 2; d++)
      ;
    if (a)
      for (g = 0; g < 2; g++)
        for (c = 0; c < 2; c += b[d+g])
          ;
    for (; e; e++)
      ;
  }
  return 0;
}

Reply via email to