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

            Bug ID: 101229
           Summary: ICE on valid code with -O3 only: in
                    vect_get_vec_defs_for_operand, at
                    tree-vect-stmts.c:1450
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.CuW17uqJjv-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210627 (experimental) [master revision
:18e95d5ce:461f937b47278eaa4ca3c5507c80cca26af4b015] (GCC)

$ cat mutant.c
int a[1024];
foo() {
  for (int i; i; i += 4) {
    int suma = a[i];
    int sumb = a[i + 1];
    int sumc;
    for (unsigned j = 0; j < 77; ++j) {
      suma = (suma ^ i) + 1;
      sumb = (sumb ^ i) + 2;
      sumc = suma ^ i;
    }
    a[i] = suma;
    a[i + 1] = sumb;
    a[i + 2] = sumc;
  }
}

$ gcc-trunk -O3 mutant.c
mutant.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    2 | foo() {
      | ^~~
during GIMPLE pass: vect
mutant.c: In function ‘foo’:
mutant.c:2:1: internal compiler error: in vect_get_vec_defs_for_operand, at
tree-vect-stmts.c:1450
0x7b93d3 vect_get_vec_defs_for_operand(vec_info*, _stmt_vec_info*, unsigned
int, tree_node*, vec<tree_node*, va_heap, vl_ptr>*, tree_node*)
        /tmp/tmp.CuW17uqJjv-gcc-builder/gcc/gcc/tree-vect-stmts.c:1450
0x1187583 vect_get_vec_defs(vec_info*, _stmt_vec_info*, _slp_tree*, unsigned
int, tree_node*, vec<tree_node*, va_heap, vl_ptr>*, tree_node*, tree_node*,
vec<tree_node*, va_heap, vl_ptr>*, tree_node*, tree_node*, vec<tree_node*,
va_heap, vl_ptr>*, tree_node*, tree_node*, vec<tree_node*, va_heap, vl_ptr>*,
tree_node*)
        /tmp/tmp.CuW17uqJjv-gcc-builder/gcc/gcc/tree-vect-stmts.c:1482
0x118766c vect_get_vec_defs(vec_info*, _stmt_vec_info*, _slp_tree*, unsigned
int, tree_node*, vec<tree_node*, va_heap, vl_ptr>*, tree_node*, vec<tree_node*,
va_heap, vl_ptr>*, tree_node*, vec<tree_node*, va_heap, vl_ptr>*, tree_node*,
vec<tree_node*, va_heap, vl_ptr>*)
        /tmp/tmp.CuW17uqJjv-gcc-builder/gcc/gcc/tree-vect-stmts.c:1504
0x11adcf4 vectorizable_lc_phi(_loop_vec_info*, _stmt_vec_info*, gimple**,
_slp_tree*)
        /tmp/tmp.CuW17uqJjv-gcc-builder/gcc/gcc/tree-vect-loop.c:7732
0x11a337d vect_transform_stmt(vec_info*, _stmt_vec_info*,
gimple_stmt_iterator*, _slp_tree*, _slp_instance*)
        /tmp/tmp.CuW17uqJjv-gcc-builder/gcc/gcc/tree-vect-stmts.c:10979
0x11c2f30 vect_transform_loop(_loop_vec_info*, gimple*)
        /tmp/tmp.CuW17uqJjv-gcc-builder/gcc/gcc/tree-vect-loop.c:9584
0x11f5bcc try_vectorize_loop_1
        /tmp/tmp.CuW17uqJjv-gcc-builder/gcc/gcc/tree-vectorizer.c:1099
0x11f6881 vectorize_loops()
        /tmp/tmp.CuW17uqJjv-gcc-builder/gcc/gcc/tree-vectorizer.c:1238
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.

Reply via email to