tests/vg_regtest: Always evaluate prerequisite expressions with sh
[valgrind.git] / memcheck / tests / custom-overlap.c
blob0babe09853089ceb2ee1663319bfe48a7019d189
1 // Test for bug 100628: need to allow custom MALLOCLIKE blocks to overlap
2 // with normal malloc() blocks in leak-checking -- if it happens, we ignore
3 // the malloc() block during the leak check.
5 #include <stdlib.h>
6 #include "valgrind.h"
8 int main(void)
10 char* x;
12 // For this one, the first custom block overlaps exactly with the start of
13 // the malloc block.
14 x = malloc(1000);
15 VALGRIND_MALLOCLIKE_BLOCK(x, /*szB*/ 16, /*rzB*/0, /*isZeroed*/0);
16 VALGRIND_MALLOCLIKE_BLOCK(x+100, /*szB*/ 32, /*rzB*/0, /*isZeroed*/0);
17 VALGRIND_MALLOCLIKE_BLOCK(x+200, /*szB*/ 64, /*rzB*/0, /*isZeroed*/0);
18 VALGRIND_MALLOCLIKE_BLOCK(x+300, /*szB*/128, /*rzB*/0, /*isZeroed*/0);
20 // For this one, the first custom block does not overlap exactly with the
21 // start of the malloc block.
22 x = malloc(1000);
23 VALGRIND_MALLOCLIKE_BLOCK(x+100, /*szB*/ 32, /*rzB*/0, /*isZeroed*/0);
24 VALGRIND_MALLOCLIKE_BLOCK(x+200, /*szB*/ 64, /*rzB*/0, /*isZeroed*/0);
25 VALGRIND_MALLOCLIKE_BLOCK(x+300, /*szB*/128, /*rzB*/0, /*isZeroed*/0);
27 return 0;