[PR 82363] Fix thinko in SRA subaccess propagation
authorMartin Jambor <mjambor@suse.cz>
Tue, 3 Oct 2017 11:43:45 +0000 (13:43 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Tue, 3 Oct 2017 11:43:45 +0000 (13:43 +0200)
2017-10-03  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/82363
* tree-sra.c (propagate_subaccesses_across_link): In unrecoverable
mismatch, mark lacc written regardless of racc.

testsuite/
* gcc.dg/tree-ssa/pr82363.c: New test.

From-SVN: r253380

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr82363.c [new file with mode: 0644]
gcc/tree-sra.c

index 25dcf02d04ab232412f42d3fd5797e08512e3a56..33ae1be901a6ede43c0bae3d9775dbb51633805b 100644 (file)
@@ -1,3 +1,9 @@
+2017-10-03  Martin Jambor  <mjambor@suse.cz>
+
+       PR tree-optimization/82363
+       * tree-sra.c (propagate_subaccesses_across_link): In unrecoverable
+       mismatch, mark lacc written regardless of racc.
+
 2017-10-03  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/82381
index 70fde548d1c62dda990ebd9284929edb4dadb751..e109ea55d551a3c3246ad4c469bc7e12918e2149 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-03  Martin Jambor  <mjambor@suse.cz>
+
+       PR tree-optimization/82363
+       * gcc.dg/tree-ssa/pr82363.c: New test.
+
 2017-10-03  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/82381
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr82363.c b/gcc/testsuite/gcc.dg/tree-ssa/pr82363.c
new file mode 100644 (file)
index 0000000..6652468
--- /dev/null
@@ -0,0 +1,50 @@
+/* { dg-do run } */
+/* { dg-options "-O" } */
+
+struct A
+{
+  int b;
+  int c;
+  int d;
+};
+
+struct E
+{
+  int f;
+  int g:18;
+  struct A h;
+};
+
+struct I
+{
+  int b;
+  int j;
+  struct E k;
+};
+
+int l, *m = &l;
+
+struct A n;
+struct I o;
+
+void __attribute__ ((noipa))
+test_l (void)
+{
+  if (l != 1)
+    __builtin_abort ();
+}
+
+int main ()
+{
+  while (1)
+    {
+      struct I q = { 0, 0, {0, 0, {1, 1, 1}}}, p = q, r = p, *s = &q;
+      if (p.k.h.c)
+        o = p;
+      *m = r.k.h.d;
+      n = (*s).k.h;
+      break;
+    }
+  test_l ();
+  return 0;
+}
index f5675edc7f1090d79e04398c6707c4af60f78454..bac593951e7206f5c5253bc5b1fd897af019f0a9 100644 (file)
@@ -2691,7 +2691,7 @@ propagate_subaccesses_across_link (struct access *lacc, struct access *racc)
            }
          else
            {
-             if (rchild->grp_write && !lacc->grp_write)
+             if (!lacc->grp_write)
                {
                  ret = true;
                  subtree_mark_written_and_enqueue (lacc);