1/* { dg-do run } */ 2/* { dg-options "-fdump-tree-alias" } */ 3/* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */ 4 5extern void abort (void); 6struct X { 7 int *p; 8 int *q; 9 int *r; 10}; 11int __attribute__((noinline)) 12foo(int i, int j, int k, __SIZE_TYPE__ off) 13{ 14 struct X x; 15 int **p, *q; 16 x.p = &i; 17 x.q = &j; 18 x.r = &k; 19 p = &x.q; 20 p += off; 21 /* *p points to { i, j, k } */ 22 q = *p; 23 return *q; 24} 25int main() 26{ 27 if (foo(1, 2, 3, -1) != 1) 28 abort (); 29 if (foo(1, 2, 3, 0) != 2) 30 abort (); 31 if (foo(1, 2, 3, 1) != 3) 32 abort (); 33 return 0; 34} 35 36/* { dg-final { scan-tree-dump "q_. = { i j k }" "alias" } } */ 37/* { dg-final { cleanup-tree-dump "alias" } } */ 38