(really) Bug 477630 - Include ucontext.h rather than sys/ucontext.h in Solaris sources
[valgrind.git] / memcheck / tests / undef_malloc_args.c
blob654d70d4a2bfd14ec5b4768218f68d8fbab8049c
1 #include <stdlib.h>
2 //#include <malloc.h>
3 #include "../memcheck.h"
4 int main (int argc, char*argv[])
6 size_t def_size = 1<<20;
7 char *p;
8 char *new_p;
10 if (argc > 10000) def_size = def_size * 2;
13 size_t size = def_size;
14 (void) VALGRIND_MAKE_MEM_UNDEFINED(&size, sizeof(size));
15 p = malloc(size);
18 (void) VALGRIND_MAKE_MEM_UNDEFINED(&p, sizeof(p));
19 new_p = realloc(p, def_size);
21 (void) VALGRIND_MAKE_MEM_UNDEFINED(&new_p, sizeof(new_p));
22 new_p = realloc(new_p, def_size);
24 (void) VALGRIND_MAKE_MEM_UNDEFINED(&new_p, sizeof(new_p));
25 free (new_p);
28 size_t nmemb = 1;
29 (void) VALGRIND_MAKE_MEM_UNDEFINED(&nmemb, sizeof(nmemb));
30 new_p = calloc(nmemb, def_size);
31 free (new_p);
33 #if 0
35 size_t alignment = 1;
36 (void) VALGRIND_MAKE_MEM_UNDEFINED(&alignment, sizeof(alignment));
37 new_p = memalign(alignment, def_size);
38 free(new_p);
42 size_t nmemb = 16;
43 size_t size = def_size;
44 (void) VALGRIND_MAKE_MEM_UNDEFINED(&size, sizeof(size));
45 new_p = memalign(nmemb, size);
46 free(new_p);
50 size_t size = def_size;
51 (void) VALGRIND_MAKE_MEM_UNDEFINED(&size, sizeof(size));
52 new_p = valloc(size);
53 free (new_p);
55 #endif
56 return 0;