summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr94598.c26
-rw-r--r--gcc/tree-sra.c6
4 files changed, 41 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7e08f789ab2..5fef2d26d88 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2020-04-16 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/94598
+ * tree-sra.c (verify_sra_access_forest): Fix verification of total
+ scalarization accesses under access to one-element arrays.
+
2020-04-16 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/89494
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 98fad24d053..5f3228396bf 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-16 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/94598
+ * gcc.dg/tree-ssa/pr94598.c: New test.
+
2020-04-16 Jakub Jelinek <jakub@redhat.com>
PR ipa/92372
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr94598.c b/gcc/testsuite/gcc.dg/tree-ssa/pr94598.c
new file mode 100644
index 00000000000..a18a796aa0a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr94598.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+struct a {
+ int b;
+ short c;
+};
+int d;
+void e() {
+ struct a f[1];
+ f[d] = f[d];
+}
+
+struct S {
+ int a[30];
+ int c;
+};
+
+int get_int (void);
+
+int foo(struct S p)
+{
+ p.c = get_int ();
+ p.a[get_int()] = get_int()+1;
+ return p.c;
+}
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 84c113c403c..227bde06257 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -2357,9 +2357,11 @@ verify_sra_access_forest (struct access *root)
gcc_assert (base == first_base);
gcc_assert (offset == access->offset);
gcc_assert (access->grp_unscalarizable_region
+ || access->grp_total_scalarization
|| size == max_size);
- gcc_assert (!is_gimple_reg_type (access->type)
- || max_size == access->size);
+ gcc_assert (access->grp_unscalarizable_region
+ || !is_gimple_reg_type (access->type)
+ || size == access->size);
gcc_assert (reverse == access->reverse);
if (access->first_child)