Fix bootstrap/PR63632
[official-gcc.git] / boehm-gc / testsuite / boehm-gc.lib / staticrootslib.c
blob6e13278a6c0858382938ad9d5a54f63e93647b96
1 #include <stdio.h>
3 #ifndef GC_DEBUG
4 # define GC_DEBUG
5 #endif
7 #include "gc.h"
9 struct treenode {
10 struct treenode *x;
11 struct treenode *y;
12 } * root[10];
14 struct treenode * libsrl_mktree(int i)
16 struct treenode * r = GC_MALLOC(sizeof(struct treenode));
17 if (0 == i) return 0;
18 if (1 == i) r = GC_MALLOC_ATOMIC(sizeof(struct treenode));
19 r -> x = libsrl_mktree(i-1);
20 r -> y = libsrl_mktree(i-1);
21 return r;
24 void * libsrl_init(void)
26 GC_INIT();
27 return GC_MALLOC(sizeof(struct treenode));
30 void * libsrl_collect (void)
32 GC_gcollect();