diff --git a/gcc/testsuite/gcc.dg/torture/pr117041.c b/gcc/testsuite/gcc.dg/torture/pr117041.c new file mode 100644 index 0000000000000000000000000000000000000000..09dbbf4c00ff7d8250a46223d983defd22608c87 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr117041.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ + +unsigned short a; +int b, c[7][6]; +int main() { + for (a = 0; a < 6; a++) + for (b = 5; b; b--) + c[a][b] = c[a+1][b]; + return 0; +} diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 43358767934612a9788c587f35f66e007faa8863..ad4a3141ab892f8d40e522e53149d4344685a3bc 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -1991,21 +1991,23 @@ get_group_load_store_type (vec_info *vinfo, stmt_vec_info stmt_info, stmt_vec_info first_stmt_info; unsigned int group_size; unsigned HOST_WIDE_INT gap; + bool single_element_p; if (STMT_VINFO_GROUPED_ACCESS (stmt_info)) { first_stmt_info = DR_GROUP_FIRST_ELEMENT (stmt_info); group_size = DR_GROUP_SIZE (first_stmt_info); gap = DR_GROUP_GAP (first_stmt_info); + single_element_p = (stmt_info == first_stmt_info + && !DR_GROUP_NEXT_ELEMENT (stmt_info)); } else { first_stmt_info = stmt_info; group_size = 1; gap = 0; + single_element_p = true; } dr_vec_info *first_dr_info = STMT_VINFO_DR_INFO (first_stmt_info); - bool single_element_p = (stmt_info == first_stmt_info - && !DR_GROUP_NEXT_ELEMENT (stmt_info)); poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype); /* True if the vectorized statements would access beyond the last