Add bug 494246 to NEWS
[valgrind.git] / memcheck / tests / clientperm.c
blob12e2123fca0f75c3bcb24a93b73d47b5be234a89
2 #include <stdio.h>
3 #include <stdlib.h>
5 #include "../memcheck.h"
7 int main1 ( void )
9 int xxx, i;
10 for (i = 0; i < 10; i++) (void) VALGRIND_CHECK_VALUE_IS_DEFINED(xxx);
11 return 0;
14 int main ( void )
16 int i, sum, m;
17 char* aa = calloc(100,1);
18 sum = 0;
20 (void) VALGRIND_CHECK_MEM_IS_DEFINED(aa,100);
22 m = VALGRIND_MAKE_MEM_UNDEFINED( &aa[49], 1 );
23 (void) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(aa,100);
25 printf("m_na: returned value is %d\n", m );
27 for (i = 0; i < 100; i++)
28 sum += aa[i];
29 if (sum > 0)
30 printf("sum is positive\n");
31 else
32 printf("sum is non-positive\n");
34 m = VALGRIND_DISCARD(m);
35 printf("m_rm: returned value is %d\n", m );
37 for (i = 0; i < 100; i++)
38 sum += aa[i];
39 if (sum > 0)
40 printf("sum is positive\n");
41 else
42 printf("sum is non-positive\n");
44 return 0;