repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Import boehm-gc snapshot, taken from
[official-gcc.git]
/
boehm-gc
/
tests
/
smash_test.c
blob
0e8b1f0808918a7ab783bc6cfc4b1e97360cf47b
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
}