2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pta-ptrarith-2.c
blobfb5b2e15ede91696c0c6ba29a7b231935d5f1d03
1 /* { dg-do run } */
2 /* { dg-options "-fdump-tree-alias" } */
3 /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
5 struct Foo {
6 int **p;
7 int **q;
8 };
10 int __attribute__((noinline))
11 bar (void)
13 struct Foo f;
14 int j, i = 1;
15 char *p;
16 int *x = &i;
17 int *y = &j;
18 f.p = &y;
19 f.q = &x;
20 p = (char *)&f;
21 for (j = 0; j < sizeof (int *); ++j)
22 p++;
23 return ***(int ***)p;
25 extern void abort (void);
26 int main()
28 if (bar () != 1)
29 abort ();
30 return 0;
33 /* In theory = { i } is the correct solution. But it's not easy to scan
34 for that reliably, so just use what we create now. */
35 /* { dg-final { scan-tree-dump "= { i j }" "alias" } } */
36 /* { dg-final { cleanup-tree-dump "alias" } } */