From: Nicholas Nethercote Date: Fri, 2 Nov 2007 04:12:48 +0000 (+0000) Subject: Fix 64-bit Massif breakage, caused by problems with integer arithmetic on X-Git-Tag: svn/VALGRIND_3_3_0~185 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6069e5a71dc38a93a1f203203839c2ed7f2864be;p=thirdparty%2Fvalgrind.git Fix 64-bit Massif breakage, caused by problems with integer arithmetic on values of different signs and sizes that only a C language lawyer would spot. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7080 --- diff --git a/massif/ms_main.c b/massif/ms_main.c index 97bf2eef9d..953027126c 100644 --- a/massif/ms_main.c +++ b/massif/ms_main.c @@ -395,7 +395,11 @@ static Char* TimeUnit_to_string(TimeUnit time_unit) } static Bool clo_heap = True; -static UInt clo_heap_admin = 8; + // clo_heap_admin is deliberately a word-sized type. At one point it was + // a UInt, but this caused problems on 64-bit machines when it was + // multiplied by a small negative number and then promoted to a + // word-sized type -- it ended up with a value of 4.2 billion. Sigh. +static SizeT clo_heap_admin = 8; static Bool clo_stacks = False; static UInt clo_depth = 30; static UInt clo_threshold = 100; // 100 == 1%