OSDN Git Service

Backported from mainline
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / pr15262-2.c
1 /* PR 15262.  Similar to pr15262-1.c but with no obvious addresses
2    being taken in function foo().  Without IPA, by only looking inside
3    foo() we cannot tell for certain whether 'q' and 'b' alias each
4    other.  */
5 struct A
6 {
7   int t;
8   int i;
9 };
10
11 struct B
12 {
13   int *p;
14   float b;
15 };
16
17 float X;
18
19 foo (struct B b, struct A *q, float *h)
20 {
21   X += *h;
22   *(b.p) = 3;
23   q->t = 2;
24   return *(b.p);
25 }
26
27 main()
28 {
29   struct A a;
30   struct B b;
31
32   b.p = &a.t;
33   if (foo (b, &a, &X) == 3)
34     abort ();
35
36   return 0;
37 }