From: Tom Hughes Date: Tue, 24 May 2005 07:22:13 +0000 (+0000) Subject: Use longs to get the error counts as valgrind will expect to return a X-Git-Tag: svn/VALGRIND_3_0_0~526 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2713ff3519a85bc682446b651ed502db793856dd;p=thirdparty%2Fvalgrind.git Use longs to get the error counts as valgrind will expect to return a machine word. Based on diagnosis by Robert Walsh . git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3792 --- diff --git a/memcheck/tests/error_counts.c b/memcheck/tests/error_counts.c index 7ec6dbfff9..89c0c23b0b 100644 --- a/memcheck/tests/error_counts.c +++ b/memcheck/tests/error_counts.c @@ -10,10 +10,10 @@ int main(void) int* reachable; int* dubious; int* leaked; - int n_reachable = 0; - int n_dubious = 0; - int n_leaked = 0; - int n_suppressed = 0; + long n_reachable = 0; + long n_dubious = 0; + long n_leaked = 0; + long n_suppressed = 0; /* we require these longs to have same size as a machine word */ assert(sizeof(long) == sizeof(void*)); @@ -33,7 +33,7 @@ int main(void) VALGRIND_DO_LEAK_CHECK; VALGRIND_COUNT_LEAKS(n_leaked, n_dubious, n_reachable, n_suppressed); if (n_reachable == 24) n_reachable = 0; /* handle glibc differences */ - printf("leaks: %dB, %dB, %dB, %dB\n", + printf("leaks: %ldB, %ldB, %ldB, %ldB\n", n_leaked, n_dubious, n_reachable, n_suppressed); leaked = malloc(77); @@ -48,7 +48,7 @@ int main(void) VALGRIND_DO_LEAK_CHECK; VALGRIND_COUNT_LEAKS(n_leaked, n_dubious, n_reachable, n_suppressed); if (n_reachable == 123) n_reachable = 99; /* handle glibc differences */ - printf("leaks: %dB, %dB, %dB, %dB\n", + printf("leaks: %ldB, %ldB, %ldB, %ldB\n", n_leaked, n_dubious, n_reachable, n_suppressed); printf("errors: %d\n", VALGRIND_COUNT_ERRORS);