Import boehm-gc snapshot, taken from
[official-gcc.git] / boehm-gc / tests / smash_test.c
blob0e8b1f0808918a7ab783bc6cfc4b1e97360cf47b
1 /*
2 * Test that overwrite error detection works reasonably.
3 */
4 #define GC_DEBUG
5 #include "gc.h"
7 #include <stdio.h>
9 #define COUNT 7000
10 #define SIZE 40
12 char * A[COUNT];
14 int main(void)
16 int i;
17 char *p;
19 GC_INIT();
21 for (i = 0; i < COUNT; ++i) {
22 A[i] = p = GC_MALLOC(SIZE);
24 if (i%3000 == 0) GC_gcollect();
25 if (i%5678 == 0 && p != 0) p[SIZE + i/2000] = 42;
27 return 0;