2 /* Check some aspects of the use of the
3 VALGRIND_ENABLE_ADDR_ERROR_REPORTING_IN_RANGE and
4 VALGRIND_DISABLE_ADDR_ERROR_REPORTING_IN_RANGE macros. */
9 #include "../memcheck.h"
13 volatile int* volatile mem
14 = (volatile int* volatile)malloc(1000 * sizeof(int));
17 // Check that we get an invalid access complaint
18 fprintf(stderr
, "\nDoing invalid access. Expect complaint.\n\n");
21 // Now disable error reporting in the range
22 fprintf(stderr
, "\nDisabling address error reporting for the range.\n\n");
23 VALGRIND_DISABLE_ADDR_ERROR_REPORTING_IN_RANGE(mem
, 1000 * sizeof(int));
25 // Check that we get an invalid access complaint
26 fprintf(stderr
, "\nDoing invalid another access. Expect no complaint.\n\n");
29 // Re-enable reporting on the first byte of one word from the ignore range
30 fprintf(stderr
, "\nPartially reenabling address error reporting.\n\n");
31 VALGRIND_ENABLE_ADDR_ERROR_REPORTING_IN_RANGE(&mem
[789], 1);
33 // Check that we get an invalid access complaint
34 fprintf(stderr
, "\nDoing a third access. Expect complaint.\n\n");
37 // And now quit and expect to see a warning about two remaining ranges
38 fprintf(stderr
, "\nExiting. Expect warnings of 2 remaining ranges.\n\n");