aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-11-08 15:27:17 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-11-08 15:27:17 +0000
commit379c6f48323d84640401189d7a3de619520bee1f (patch)
treecad0c20809d9bad6468bb16bf7e541fb0d7790a0
parentd770e88d122c56f9ec952817ced18ecdc3e39d31 (diff)
downloadgcc-379c6f48323d84640401189d7a3de619520bee1f.zip
gcc-379c6f48323d84640401189d7a3de619520bee1f.tar.gz
gcc-379c6f48323d84640401189d7a3de619520bee1f.tar.bz2
tree-ssa-structalias.c (build_succ_graph): Properly make variables escape if they are stored to anything.
2009-11-08 Richard Guenther <rguenther@suse.de> * tree-ssa-structalias.c (build_succ_graph): Properly make variables escape if they are stored to anything. * gcc.dg/torture/pta-escape-1.c: New testcase. From-SVN: r154010
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/torture/pta-escape-1.c34
-rw-r--r--gcc/tree-ssa-structalias.c3
4 files changed, 46 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 638d9a4..41f5b64 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2009-11-08 Richard Guenther <rguenther@suse.de>
+ * tree-ssa-structalias.c (build_succ_graph): Properly make
+ variables escape if they are stored to anything.
+
+2009-11-08 Richard Guenther <rguenther@suse.de>
+
PR rtl-optimization/41928
* loop-invariant.c (free_loop_data): If we didn't allocate
loop data do not try to free it.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 73021d0..9282ec3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2009-11-08 Richard Guenther <rguenther@suse.de>
+
+ * gcc.dg/torture/pta-escape-1.c: New testcase.
+
2009-11-08 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/rep_clause4.adb: New test.
diff --git a/gcc/testsuite/gcc.dg/torture/pta-escape-1.c b/gcc/testsuite/gcc.dg/torture/pta-escape-1.c
new file mode 100644
index 0000000..39aefb5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pta-escape-1.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-options "-fdump-tree-alias" } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
+
+int *p;
+void __attribute__((noinline,noclone))
+bar (void)
+{
+ *p = 1;
+}
+int __attribute__((noinline,noclone))
+foo (__SIZE_TYPE__ addr)
+{
+ int i;
+ /* q points to ANYTHING */
+ int **q = (int **)addr;
+ /* this store needs to cause i to escape */
+ *q = &i;
+ i = 0;
+ /* and thus be clobbered by this function call */
+ bar ();
+ return i;
+}
+extern void abort (void);
+int
+main()
+{
+ if (foo ((__SIZE_TYPE__)&p) != 1)
+ abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump "ESCAPED = { i }" "alias" } } */
+/* { dg-final { cleanup-tree-dump "alias" } } */
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 619875c..e0a681d 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -1278,6 +1278,9 @@ build_succ_graph (void)
&& get_varinfo (i)->may_have_pointers)
add_graph_edge (graph, find (i), t);
}
+
+ /* Everything stored to ANYTHING also potentially escapes. */
+ add_graph_edge (graph, find (escaped_id), t);
}