Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pta-escape-3.c
blobb0f36ed81861b474e1d9fc0c7732a4a5617701d8
1 /* { dg-do run } */
2 /* { dg-options "-O -fdump-tree-alias-details -fdelete-null-pointer-checks" } */
4 int *i;
5 void __attribute__((noinline))
6 foo (void)
8 *i = 1;
10 int **__attribute__((noinline,const))
11 foobar (void)
13 return &i;
15 int __attribute__((noinline))
16 bar(int local_p)
18 int x = 0;
19 int *j;
20 int **p;
21 if (local_p)
22 p = &j;
23 else
24 p = foobar();
25 *p = &x; /* This makes x escape. */
26 foo ();
27 return x;
29 extern void abort (void);
30 int main()
32 int k = 2;
33 i = &k;
34 if (bar (1) != 0 || k != 1)
35 abort ();
36 if (bar (0) != 1)
37 abort ();
38 return 0;
41 /* { dg-final { scan-tree-dump "ESCAPED = { NULL ESCAPED NONLOCAL x }" "alias" { target { ! keeps_null_pointer_checks } } } } */
42 /* { dg-final { scan-tree-dump "ESCAPED = { ESCAPED NONLOCAL x }" "alias" { target { keeps_null_pointer_checks } } } } */