gcc/boehm-gc/tests/staticrootstest.c
Dave Korn be0959d219 re PR target/42811 (java.lang.ExceptionInInitializerError in ecj1)
PR target/42811
	* tests/staticrootstest.c: New test source file.
	* tests/staticrootslib.c: New test library source file.
	* Makefile.am (test_ldadd): New variable.
	(gctest_LDADD): Use it.
	(TESTS): Add leaktest, middletest and staticrootstest.
	(check_PROGRAMS): Likewise.
	(leaktest_SOURCES): New libtool variable definition.
	(leaktest_LDADD): Likewise.
	(leaktest_LDFLAGS): Likewise.
	(leaktest_LINK): Likewise.
	(middletest_SOURCES): Likewise.
	(middletest_LDADD): Likewise.
	(middletest_LDFLAGS): Likewise.
	(middletest_LINK): Likewise.
	(staticrootstest_SOURCES): Likewise.
	(staticrootstest_LDADD): Likewise.
	(staticrootstest_LDFLAGS): Likewise.
	(staticrootstest_LINK): Likewise.
	(check_LTLIBRARIES): Likewise.
	(libstaticrootslib_la_SOURCES): Likewise.
	(libstaticrootslib_la_LIBADD): Likewise.
	(libstaticrootslib_la_LDFLAGS): Likewise.
	(libstaticrootslib_la_DEPENDENCIES): Likewise.
	* Makefile.in: Regenerate.

From-SVN: r159115
2010-05-06 16:20:53 +00:00

47 lines
883 B
C

#include <stdio.h>
#ifndef GC_DEBUG
# define GC_DEBUG
#endif
#include "gc.h"
#include "gc_backptr.h"
struct treenode {
struct treenode *x;
struct treenode *y;
} * root[10];
static char *staticroot = 0;
extern struct treenode * libsrl_mktree(int i);
extern void * libsrl_init(void);
extern void * libsrl_collect (void);
int main(void)
{
int i;
staticroot = libsrl_init();
for (i = 0; i < sizeof(struct treenode); ++i) {
staticroot[i] = 0x42;
}
libsrl_collect();
for (i = 0; i < 10; ++i) {
root[i] = libsrl_mktree(12);
libsrl_collect();
}
for (i = 0; i < sizeof(struct treenode); ++i) {
if (staticroot[i] != 0x42)
return -1;
}
for (i = 0; i < 10; ++i) {
root[i] = libsrl_mktree(12);
libsrl_collect();
}
for (i = 0; i < sizeof(struct treenode); ++i) {
if (staticroot[i] != 0x42)
return -1;
}
return 0;
}