Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/pr15262-2.c

raw
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
6 void abort (void);
7
8 struct A
9 {
10 int t;
11 int i;
12 };
13
14 struct B
15 {
16 int *p;
17 float b;
18 };
19
20 float X;
21
22 int
23 foo (struct B b, struct A *q, float *h)
24 {
25 X += *h;
26 *(b.p) = 3;
27 q->t = 2;
28 return *(b.p);
29 }
30
31 int
32 main(void)
33 {
34 struct A a;
35 struct B b;
36
37 b.p = &a.t;
38 if (foo (b, &a, &X) == 3)
39 abort ();
40
41 return 0;
42 }