implemented Setup.hs to build boehm cpp libs and install them;
[hs-boehmgc.git] / gc-7.2 / tests / smash_test.c
1 /*
2  * Test that overwrite error detection works reasonably.
3  */
4 #define GC_DEBUG
5 #include "gc.h"
6
7 #include <stdio.h>
8
9 #define COUNT 7000
10 #define SIZE  40
11
12 char * A[COUNT];
13
14 int main(void)
15 {
16   int i;
17   char *p;
18
19   GC_INIT();
20
21   for (i = 0; i < COUNT; ++i) {
22      A[i] = p = GC_MALLOC(SIZE);
23
24      if (i%3000 == 0) GC_gcollect();
25      if (i%5678 == 0 && p != 0) p[SIZE + i/2000] = 42;
26   }
27   return 0;
28 }