Fix bootstrap/PR63632
[official-gcc.git] / boehm-gc / testsuite / boehm-gc.lib / staticrootstest.c
bloba029ccf4276b9c7a3229b75719028d21d2d64ce5
1 /* { dg-add-shlib "staticrootslib.c" } */
3 #include <stdio.h>
5 #ifndef GC_DEBUG
6 # define GC_DEBUG
7 #endif
9 #include "gc.h"
10 #include "gc_backptr.h"
12 struct treenode {
13 struct treenode *x;
14 struct treenode *y;
15 } * root[10];
17 static char *staticroot = 0;
19 extern struct treenode * libsrl_mktree(int i);
20 extern void * libsrl_init(void);
21 extern void * libsrl_collect (void);
23 int main(void)
25 int i;
26 staticroot = libsrl_init();
27 for (i = 0; i < sizeof(struct treenode); ++i) {
28 staticroot[i] = 0x42;
30 libsrl_collect();
31 for (i = 0; i < 10; ++i) {
32 root[i] = libsrl_mktree(12);
33 libsrl_collect();
35 for (i = 0; i < sizeof(struct treenode); ++i) {
36 if (staticroot[i] != 0x42)
37 return -1;
39 for (i = 0; i < 10; ++i) {
40 root[i] = libsrl_mktree(12);
41 libsrl_collect();
43 for (i = 0; i < sizeof(struct treenode); ++i) {
44 if (staticroot[i] != 0x42)
45 return -1;
47 return 0;