Hi,
This patch fixes ICE reported in PR78684, it checks sign bit of integer const
thus can handle unsigned types. Bootstrap and test on x86_64, is it OK?
Thanks,
bin
2016-12-06 Bin Cheng <bin.ch...@arm.com>
PR middle-end/78684
* tree-vect-loop-manip.c (create_intersect_range_checks_index): Check
sign bit for index step of data reference.
gcc/testsuite/ChangeLog
2016-12-06 Bin Cheng <bin.ch...@arm.com>
PR middle-end/78684
* g++.dg/torture/pr78684.C: New test.
diff --git a/gcc/testsuite/g++.dg/torture/pr78684.C
b/gcc/testsuite/g++.dg/torture/pr78684.C
new file mode 100644
index 0000000..5d71be5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr78684.C
@@ -0,0 +1,20 @@
+// PR middle-end/78684
+// { dg-do compile }
+
+class a {
+public:
+ a(long);
+ void operator<<=(long) {
+ long b;
+ for (unsigned long c; c; c--)
+ d[c + b] = d[c];
+ }
+ a &g();
+ long d[28];
+};
+long e;
+int f;
+void j() {
+ a h(e), i = h;
+ i.g() <<= f;
+}
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index e13d6a2..beb2f06 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -2070,8 +2070,7 @@ create_intersect_range_checks_index (loop_vec_info
loop_vinfo, tree *cond_expr,
/* Index must have const step, otherwise DR_STEP won't be constant. */
gcc_assert (TREE_CODE (idx_step) == INTEGER_CST);
/* Index must evaluate in the same direction as DR. */
- gcc_assert (!neg_step
- || tree_int_cst_compare (idx_step, size_zero_node) < 0);
+ gcc_assert (!neg_step || tree_int_cst_sign_bit (idx_step) == 1);
tree min1 = CHREC_LEFT (access1);
tree min2 = CHREC_LEFT (access2);