* lib/target-supports.exp (check_effective_target_size32plus):
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pta-ptrarith-3.c
blob4b18e1aa3ac18cd0b409f6c3ed92102c57b23825
1 /* { dg-do run } */
2 /* { dg-options "-fdump-tree-alias" } */
3 /* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */
5 extern void abort (void);
6 struct X {
7 int *p;
8 int *q;
9 int *r;
11 int __attribute__((noinline))
12 foo(int i, int j, int k, __SIZE_TYPE__ off)
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;
25 int main()
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;
36 /* { dg-final { scan-tree-dump "q_. = { i j k }" "alias" } } */
37 /* { dg-final { cleanup-tree-dump "alias" } } */