re PR tree-optimization/71872 (ICE in inchash::add_expr, at tree.c:7782 - OEP_ADDRESS...
authorJakub Jelinek <jakub@redhat.com>
Thu, 14 Jul 2016 18:30:38 +0000 (20:30 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 14 Jul 2016 18:30:38 +0000 (20:30 +0200)
PR tree-optimization/71872
* tree-data-ref.c (get_references_in_stmt): Ignore references
with is_gimple_constant get_base_address.

* gcc.c-torture/compile/pr71872.c: New test.

From-SVN: r238351

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

index e62f2d8fc9cbcd37efa9f702c378982ed657d0ae..8da237861a182eb0c0eca1580f7bd09f9c15c887 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/71872
+       * tree-data-ref.c (get_references_in_stmt): Ignore references
+       with is_gimple_constant get_base_address.
+
 2016-07-14  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        * config/arm/arm.h (TARGET_HAVE_LDACQ): Enable for ARMv8-M Mainline.
index 95705821eb17e24508beca1f2fb5a673650fdd21..6b0c7b8a1b524d28118baf14e23c3cccd936fd56 100644 (file)
@@ -1,3 +1,8 @@
+2016-07-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/71872
+       * gcc.c-torture/compile/pr71872.c: New test.
+
 2016-07-14  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        * gcc.target/arm/atomic-comp-swap-release-acquire.c: Rename into ...
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr71872.c b/gcc/testsuite/gcc.c-torture/compile/pr71872.c
new file mode 100644 (file)
index 0000000..6db80db
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR tree-optimization/71872 */
+
+struct __attribute__((may_alias)) S { int a; };
+
+void
+foo (int *x, struct S *y)
+{
+  int i;
+  for (i = 0; i < 16; i++)
+    {
+      int a = 0;
+      if (*x)
+        *(struct S *) y = *(struct S *) &a;
+    }
+}
index 337d278790a2b3e6ddffd0ffc539fbdd0672ebde..081ee60319320612b8d1fa606a1c4c8804784e49 100644 (file)
@@ -3868,7 +3868,8 @@ get_references_in_stmt (gimple *stmt, vec<data_ref_loc, va_heap> *references)
       if (DECL_P (op1)
          || (REFERENCE_CLASS_P (op1)
              && (base = get_base_address (op1))
-             && TREE_CODE (base) != SSA_NAME))
+             && TREE_CODE (base) != SSA_NAME
+             && !is_gimple_min_invariant (base)))
        {
          ref.ref = op1;
          ref.is_read = true;