re PR tree-optimization/84929 (ICE at -O3 on valid code on x86_64-linux-gnu: tree...
authorRichard Biener <rguenther@suse.de>
Mon, 19 Mar 2018 12:49:30 +0000 (12:49 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 19 Mar 2018 12:49:30 +0000 (12:49 +0000)
2018-03-19  Richard Biener  <rguenther@suse.de>

PR tree-optimization/84929
* tree-data-ref.c (analyze_siv_subscript_cst_affine): Guard
chrec_is_positive against non-chrec arg.

* gcc.dg/torture/pr84929.c: New testcase.

From-SVN: r258643

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

index 9e1ccaf80272567c75a10cf39ee65c27196daeca..b5b55598f81dad9dec12ba5b8f9663f8f884ea1a 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-19  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/84929
+       * tree-data-ref.c (analyze_siv_subscript_cst_affine): Guard
+       chrec_is_positive against non-chrec arg.
+
 2018-03-19  Tamar Christina  <tamar.christina@arm.com>
 
        PR target/84711
index 865c85117b8bde4c5a635d77971ac9f40cad3fd6..868d8e8f7a63da0574dcb280c16d1edd1aaadd3f 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-19  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/84929
+       * gcc.dg/torture/pr84929.c: New testcase.
+
 2018-03-19  Tamar Christina  <tamar.christina@arm.com>
 
        PR target/84711
diff --git a/gcc/testsuite/gcc.dg/torture/pr84929.c b/gcc/testsuite/gcc.dg/torture/pr84929.c
new file mode 100644 (file)
index 0000000..2f46e29
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target int32plus } */
+
+int a[4];
+void fn1()
+{
+  __UINT64_TYPE__ b = 7818038963515661296;
+  for (;; b++)
+    a[0xA699ECD2C348A3A0] = a[b];
+}
index a886329966cb89361c187afebbe1870c6f06e62e..af35e41c745af3915a28ed53c3acb10a656dd92d 100644 (file)
@@ -3015,7 +3015,8 @@ analyze_siv_subscript_cst_affine (tree chrec_a,
     {
       if (value0 == false)
        {
-         if (!chrec_is_positive (CHREC_RIGHT (chrec_b), &value1))
+         if (TREE_CODE (chrec_b) != POLYNOMIAL_CHREC
+             || !chrec_is_positive (CHREC_RIGHT (chrec_b), &value1))
            {
              if (dump_file && (dump_flags & TDF_DETAILS))
                fprintf (dump_file, "siv test failed: chrec not positive.\n");
@@ -3096,7 +3097,8 @@ analyze_siv_subscript_cst_affine (tree chrec_a,
        }
       else
        {
-         if (!chrec_is_positive (CHREC_RIGHT (chrec_b), &value2))
+         if (TREE_CODE (chrec_b) != POLYNOMIAL_CHREC
+             || !chrec_is_positive (CHREC_RIGHT (chrec_b), &value2))
            {
              if (dump_file && (dump_flags & TDF_DETAILS))
                fprintf (dump_file, "siv test failed: chrec not positive.\n");