On Fri, Nov 02, 2007 at 04:12:50AM +0000, [EMAIL PROTECTED] wrote:
> Author: njn
> -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;
>
this is really odd ...
the code in update_heap_stats() did this:
  (unsigned long) = (unsigned long) + (unsigned int) * (signed int);
while the actual multiplication is signed, the result is taken to be
unsigned and is accordingly zero-extended in the promotion.
you converted this to
  (unsigned long) = (unsigned long) + (unsigned long) * (signed int);
which is about the right thing to do. however, for *way* more clarity
and less bloat i'd suggest writing the actual expression as
  update_alloc_stats(heap_szB_delta + 
(SizeT)clo_heap_admin*n_heap_blocks_delta);
instead of making the variable bigger.

btw, in ms_post_clo_init() you'll get a warning, because, duh, an
unsigned value cannot be smaller than zero.

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Valgrind-developers mailing list
Valgrind-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to