aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2017-10-03 13:43:45 +0200
committerMartin Jambor <jamborm@gcc.gnu.org>2017-10-03 13:43:45 +0200
commit3b7511f9219038110e5b464f197266564e2f8c76 (patch)
tree5608cd966e124eec350996a08c760328f2af49e7
parent33ff5dda9fe0dd67216ec38a6b1143d9adc3948a (diff)
downloadgcc-3b7511f9219038110e5b464f197266564e2f8c76.zip
gcc-3b7511f9219038110e5b464f197266564e2f8c76.tar.gz
gcc-3b7511f9219038110e5b464f197266564e2f8c76.tar.bz2
[PR 82363] Fix thinko in SRA subaccess propagation
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
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr82363.c50
-rw-r--r--gcc/tree-sra.c2
4 files changed, 62 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 25dcf02..33ae1be 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 70fde54..e109ea5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..6652468
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr82363.c
@@ -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;
+}
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index f5675ed..bac5939 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -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);