OSDN Git Service

PR testsuite/51128
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / torture / pr39074.c
1 /* { dg-do run } */
2 /* { dg-options "-fdump-tree-alias" } */
3 /* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */
4
5 typedef __PTRDIFF_TYPE__ intptr_t;
6
7 int i;
8 void __attribute__((noinline))
9 foo(long b, intptr_t q)
10 {
11   int *y;
12   int **a = &y, **x;
13   int ***p;
14   if (b)
15     p = (int ***)q;
16   else
17     p = &a;
18   x = *p;
19   *x = &i;  /* *ANYTHING = &i has to make sure that y points to i.  */
20   *y = 0;
21 }
22 extern void abort (void);
23 int main()
24 {
25   i = 1;
26   foo (0, 0);
27   if (i != 0)
28     abort ();
29   return 0;
30 }
31
32 /* { dg-final { scan-tree-dump "y.._., points-to vars: { i }" "alias" } } */
33 /* { dg-final { cleanup-tree-dump "alias" } } */