OSDN Git Service

Merge tree-ssa-20020619-branch into mainline.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / 20040319-1.c
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
3
4 /* Test derived from PR 14643.  When a function has no addressable
5    variables but 2 or more pointers have conflicting memory tags, they
6    were not being processed by the type based alias analyzer,
7    resulting in optimizations removing a non-redundant load.  */
8
9 struct bar { int count;  int *arr;};
10
11 void foo (struct bar *b)
12 {
13   b->count = 0;
14   *(b->arr) = 2;
15   if (b->count == 0)    /* b->count can't be assumed to be 0 here.  */
16     abort ();
17 }
18
19 main ()
20 {
21   struct bar x;
22   x.arr = &x.count;
23   foo (&x);
24   return 0;
25 }