re PR tree-optimization/84132 (tree-data-ref.c:3938: poor coding ?)
authorRichard Biener <rguenther@suse.de>
Wed, 31 Jan 2018 13:07:53 +0000 (13:07 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 31 Jan 2018 13:07:53 +0000 (13:07 +0000)
2018-01-31  Richard Biener  <rguenther@suse.de>

PR tree-optimization/84132
* tree-data-ref.c (analyze_miv_subscript): Properly
check whether evolution_function_is_affine_multivariate_p
before calling gcd_of_steps_may_divide_p.

* g++.dg/torture/pr84132.C: New testcase.

From-SVN: r257232

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr84132.C [new file with mode: 0644]
gcc/tree-data-ref.c

index 8368986fbc872c9731135733cb57adf0a496f38a..b1e0891ba8c7c5bd4e01911e696cd6bf6eea775d 100644 (file)
@@ -1,3 +1,10 @@
+2018-01-31  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/84132
+       * tree-data-ref.c (analyze_miv_subscript): Properly
+       check whether evolution_function_is_affine_multivariate_p
+       before calling gcd_of_steps_may_divide_p.
+
 2018-01-31  Julia Koval  <julia.koval@intel.com>
 
        PR target/83618
index eaa672beb246493253c5bbacb3c0b4d111689010..e3f0c5aafccfa52265c9d5d77f9903aa3f1af627 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-31  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/84132
+       * g++.dg/torture/pr84132.C: New testcase.
+
 2018-01-31  Jan Hubicka  <hubicka@ucw.cz>
 
        * g++.dg/torture/pr81360.C: Drop unintended -O2 from dg-options and
diff --git a/gcc/testsuite/g++.dg/torture/pr84132.C b/gcc/testsuite/g++.dg/torture/pr84132.C
new file mode 100644 (file)
index 0000000..205b8f6
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+struct g {
+    char b;
+    unsigned char *d[];
+} e;
+unsigned char f;
+void i()
+{
+  for (int h;; h++)
+    {
+      unsigned a = h;
+      for (int c = 0; c < 256; c += 6)
+       for (int h = c; h < c + 6; h++)
+         e.d[h + a] = &f;
+    }
+}
index e39067d71348fbdeebc8a0172823c0a9ae1bafce..0b6ad5fd5290b7373deea55b2f6b0449d7b7ace6 100644 (file)
@@ -3976,9 +3976,8 @@ analyze_miv_subscript (tree chrec_a,
     }
 
   else if (evolution_function_is_constant_p (difference)
-          /* For the moment, the following is verified:
-             evolution_function_is_affine_multivariate_p (chrec_a,
-             loop_nest->num) */
+          && evolution_function_is_affine_multivariate_p (chrec_a,
+                                                          loop_nest->num)
           && !gcd_of_steps_may_divide_p (chrec_a, difference))
     {
       /* testsuite/.../ssa-chrec-33.c