1 #include <stdlib.h>
2 
3 union tree_node;
4 
5 struct tree_common
6 {
7   int a;
8   long b;
9   long c;
10   void *p;
11   int d;
12 };
13 
14 struct other_tree
15 {
16   struct tree_common common;
17   int arr[14];
18 };
19 
20 struct tree_vec
21 {
22   struct tree_common common;
23   int length;
24   union tree_node *a[1];
25 };
26 
27 union tree_node
28 {
29   struct other_tree othr;
30   struct tree_vec vec;
31 };
32 
33 union tree_node global;
34 
35 union tree_node * __attribute__((noinline))
foo(union tree_node * p,int i)36 foo (union tree_node *p, int i)
37 {
38   union tree_node **q;
39   p->vec.a[i] = (union tree_node *) 0;
40   q = &p->vec.a[1];
41   *q = &global;
42   return p->vec.a[i];
43 }
44 
45 extern void abort (void);
46 extern void *malloc (__SIZE_TYPE__);
47 
48 int
main()49 main()
50 {
51   union tree_node *p = malloc (sizeof (union tree_node));
52   if (foo (p, 1) != &global)
53     abort ();
54   return 0;
55 }
56 
57