Hi,

a week has passed with PR 69920 fix in and it seems to have fixed all
issues caused by the fix to PR 69666, which I have reverted on the
gcc-5 branch.

So I am going to un-do that revert and backport the PR 69920 fix in
one commit to the branch, after final bootstrap and testing runs
finish (actually, it has passed successfully on x86_64-linux, there is
one on i686 that is still running).

Thanks,

Martin


2016-03-03  Martin Jambor  <mjam...@suse.cz>

        PR tree-optimization/69666
        PR middle-end/69920
        * tree-sra.c (sra_modify_assign): Do not attempt to create
        default_def replacements for unscalarizable regions.  Do not
        remove loads of uninitialized aggregates to SSA_NAMEs.

testsuite/
        * gcc.dg/torture/pr69932.c: New test.
        * gcc.dg/torture/pr69936.c: Likewise.

diff --git a/gcc/testsuite/gcc.dg/torture/pr69932.c 
b/gcc/testsuite/gcc.dg/torture/pr69932.c
new file mode 100644
index 0000000..4b82130
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr69932.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+
+int a;
+void fn1() {
+  int b = 4;
+  short c[4];
+  c[b] = c[a];
+  if (c[2]) {}
+
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr69936.c 
b/gcc/testsuite/gcc.dg/torture/pr69936.c
new file mode 100644
index 0000000..3023bbb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr69936.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+
+int a;
+char b;
+void fn1(int p1) {}
+
+int fn2() { return 5; }
+
+void fn3() {
+  if (fn2())
+    ;
+  else {
+    char c[5];
+    c[0] = 5;
+  lbl_608:
+    fn1(c[9]);
+    int d = c[9];
+    c[2] | a;
+    d = c[b];
+  }
+  goto lbl_608;
+}
+
+int main() { return 0; }
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 145a07c..3457aac 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -3242,6 +3242,7 @@ sra_modify_assign (gimple stmt, gimple_stmt_iterator *gsi)
     }
   else if (racc
           && !racc->grp_unscalarized_data
+          && !racc->grp_unscalarizable_region
           && TREE_CODE (lhs) == SSA_NAME
           && !access_has_replacements_p (racc))
     {
@@ -3405,7 +3406,8 @@ sra_modify_assign (gimple stmt, gimple_stmt_iterator *gsi)
       else
        {
          if (access_has_children_p (racc)
-             && !racc->grp_unscalarized_data)
+             && !racc->grp_unscalarized_data
+             && TREE_CODE (lhs) != SSA_NAME)
            {
              if (dump_file)
                {

Reply via email to