On Fri, 2 Nov 2007, Oswald Buddenhagen wrote:

> this is really odd ...

That's what I thought :)

> 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.

I thought about following your suggestion, but your solution only fixes that 
particular expression, whereas making it a SizeT avoids the possibility of 
it happening elsewhere.

Thanks for the explanation, that's basically what I thought was happening 
but you explained it more clearly than I had understood it in my head.

Nick

-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to