blob: fb5b2e15ede91696c0c6ba29a7b231935d5f1d03 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/* { dg-do run } */
/* { dg-options "-fdump-tree-alias" } */
/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
struct Foo {
int **p;
int **q;
};
int __attribute__((noinline))
bar (void)
{
struct Foo f;
int j, i = 1;
char *p;
int *x = &i;
int *y = &j;
f.p = &y;
f.q = &x;
p = (char *)&f;
for (j = 0; j < sizeof (int *); ++j)
p++;
return ***(int ***)p;
}
extern void abort (void);
int main()
{
if (bar () != 1)
abort ();
return 0;
}
/* In theory = { i } is the correct solution. But it's not easy to scan
for that reliably, so just use what we create now. */
/* { dg-final { scan-tree-dump "= { i j }" "alias" } } */
/* { dg-final { cleanup-tree-dump "alias" } } */
|