2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pta-escape-1.c
blobee8a84bd06fcbff4e5b325c05714ff461101e838
1 /* { dg-do run } */
2 /* { dg-options "-O -fdump-tree-alias-details" } */
4 int *i;
5 void __attribute__((noinline))
6 foo (void)
8 *i = 1;
10 int __attribute__((noinline))
11 bar(int local_p)
13 int x = 0;
14 int *j;
15 int **p;
16 if (local_p)
17 p = &j;
18 else
19 p = &i;
20 *p = &x; /* This makes x escape. */
21 foo ();
22 return x;
24 extern void abort (void);
25 int main()
27 int k = 2;
28 i = &k;
29 if (bar (1) != 0 || k != 1)
30 abort ();
31 if (bar (0) != 1)
32 abort ();
33 return 0;
36 /* { dg-final { scan-tree-dump "ESCAPED, points-to vars: { x }" "alias" } } */
37 /* { dg-final { cleanup-tree-dump "alias" } } */