* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154010
138bc75d-0d04-0410-961f-
82ee72b054a4
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.
+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.
--- /dev/null
+/* { 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" } } */
&& 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);
}