Tests for globals with different kinds of behavior in DS Analysis.
[oota-llvm.git] / test / DSGraphs / ggcollapse.c
1 #include <stdio.h>
2
3 typedef struct Tree_struct {
4   int data;
5   struct Tree_struct *left, *right;
6 } Tree;
7
8 static Tree T1, T2, T3, T4, T5;
9 static Tree *Root, *ANode;
10 static int  N = 4107;
11
12 /* forces *Tb->right to be collapsed */
13 void makeMore(Tree* Ta, Tree* Tb)
14 {
15   Ta->left  = &T1;
16   Ta->right = &T2;
17   Tb->left  = &T4;
18   Tb->right = (Tree*) (((char*) &T5) + 5); /* point to fifth byte of T5 */
19 }
20
21 void makeRoots()
22 {
23   T1.left = &T2;
24   makeMore(&T1, &T3);
25 }
26
27 int main()
28 {
29   makeRoots();
30   T3.right = &T4;
31   printf("T3.data = %d\n", T3.data);
32 }