Enable sys_adjtimex() on arm-linux. Fixes #412408.
[valgrind.git] / memcheck / tests / holey_buffer_too_small.c
blob0cc4d028a7a4fe8f8825eba47ff8107535f8cadb
2 #include <stdlib.h>
3 #include <stdio.h>
5 #include "../memcheck.h"
7 /* This test checks that VALGRIND_CHECK_MEM_IS_DEFINED correctly
8 reports two errors when presented with a buffer which contains both
9 undefined data and some out of range component(s), and the
10 undefined data appears before the out of range components. Should
11 report 5 errors in total: the first test should report 2, the rest
12 1 each. */
14 int main ( void )
16 char* a;
18 fprintf(stderr, "\n---- part defined, address error at end ----\n\n");
19 a = malloc(8);
20 a[0] = a[1] = a[2] = a[3] = a[6] = a[7] = 'x';
21 (void) VALGRIND_CHECK_MEM_IS_DEFINED(a, 9);
22 free(a);
24 fprintf(stderr, "\n---- part defined, address error at start ----\n\n");
25 a = malloc(8);
26 a[0] = a[1] = a[2] = a[3] = a[6] = a[7] = 'x';
27 (void) VALGRIND_CHECK_MEM_IS_DEFINED(a-1, 9);
28 free(a);
30 fprintf(stderr, "\n---- fully defined, address error at end ----\n\n");
31 a = malloc(8);
32 a[0] = a[1] = a[2] = a[3] = a[4] = a[5] = a[6] = a[7] = 'x';
33 (void) VALGRIND_CHECK_MEM_IS_DEFINED(a, 9);
34 free(a);
36 fprintf(stderr, "\n---- fully defined, address error at start ----\n\n");
37 a = malloc(8);
38 a[0] = a[1] = a[2] = a[3] = a[4] = a[5] = a[6] = a[7] = 'x';
39 (void) VALGRIND_CHECK_MEM_IS_DEFINED(a-1, 9);
40 free(a);
42 return 0;