2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pta-ptrarith-1.c
blob2a8dc9e3037d32e051adb419c9e46b8b8bd0019c
1 /* { dg-do run } */
2 /* { dg-options "-fdump-tree-alias" } */
3 /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
5 struct Foo {
6 int *p;
7 };
9 void __attribute__((noinline))
10 foo (void *p)
12 struct Foo *f = (struct Foo *)p - 1;
13 *f->p = 0;
16 int bar (void)
18 struct Foo f;
19 int i = 1;
20 f.p = &i;
21 foo (&f + 1);
22 return i;
24 extern void abort (void);
25 int main()
27 if (bar () != 0)
28 abort ();
29 return 0;
32 /* { dg-final { scan-tree-dump "ESCAPED = { ESCAPED NONLOCAL f .* i }" "alias" } } */
33 /* { dg-final { cleanup-tree-dump "alias" } } */