re PR tree-optimization/61681 (wrong code at -Os and above on x86_64-linux-gnu)
authorRichard Biener <rguenther@suse.de>
Tue, 8 Jul 2014 09:04:29 +0000 (09:04 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 8 Jul 2014 09:04:29 +0000 (09:04 +0000)
2014-07-08  Richard Biener  <rguenther@suse.de>

PR tree-optimization/61681
* tree-ssa-structalias.c (find_what_var_points_to): Expand
NONLOCAL inside ESCAPED.

* gcc.dg/torture/pr61681.c: New testcase.

From-SVN: r212349

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr61681.c [new file with mode: 0644]
gcc/tree-ssa-structalias.c

index 726c86f..3dcd84a 100644 (file)
@@ -1,5 +1,11 @@
 2014-07-08  Richard Biener  <rguenther@suse.de>
 
+       PR tree-optimization/61681
+       * tree-ssa-structalias.c (find_what_var_points_to): Expand
+       NONLOCAL inside ESCAPED.
+
+2014-07-08  Richard Biener  <rguenther@suse.de>
+
        PR tree-optimization/61680
        * tree-vect-data-refs.c (vect_analyze_data_ref_dependence):
        Handle properly all read-write dependences with group accesses.
index 523e6c4..635f8ea 100644 (file)
@@ -1,5 +1,10 @@
 2014-07-08  Richard Biener  <rguenther@suse.de>
 
+       PR tree-optimization/61681
+       * gcc.dg/torture/pr61681.c: New testcase.
+
+2014-07-08  Richard Biener  <rguenther@suse.de>
+
        PR tree-optimization/61680
        * gcc.dg/vect/pr61680.c: New testcase.
 
diff --git a/gcc/testsuite/gcc.dg/torture/pr61681.c b/gcc/testsuite/gcc.dg/torture/pr61681.c
new file mode 100644 (file)
index 0000000..226de0c
--- /dev/null
@@ -0,0 +1,37 @@
+/* { dg-do run } */
+
+extern void abort (void);
+
+int a = 1, *e = &a, **f = &e, *l, *p, j;
+static int b;
+long d;
+short g;
+
+void
+fn1 (int *p)
+{
+  int m;
+  if (!(*p & j))
+    {
+      int *n = &m;
+      for (d = 6; d; d--)
+       {
+         for (g = 0; g < 1; g++)
+           {
+             n = l = *f;
+             b = *p;
+           }
+         *n = 0;
+       }
+    }
+}
+
+int
+main ()
+{
+  p = *f;
+  fn1 (p);
+  if (b != 0)
+    abort ();
+  return 0;
+}
index 0472239..221877e 100644 (file)
@@ -6106,6 +6106,10 @@ find_what_var_points_to (varinfo_t orig_vi)
                pt->ipa_escaped = 1;
              else
                pt->escaped = 1;
+             /* Expand some special vars of ESCAPED in-place here.  */
+             varinfo_t evi = get_varinfo (find (escaped_id));
+             if (bitmap_bit_p (evi->solution, nonlocal_id))
+               pt->nonlocal = 1;
            }
          else if (vi->id == nonlocal_id)
            pt->nonlocal = 1;