From: Junio C Hamano Date: Thu, 15 Sep 2005 08:17:16 GMT Subject: Re: git-diff-tree rename detection bug Message-ID: <7vll1y9243.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <17192.65054.520959.454610@cargo.ozlabs.ibm.com> Paul Mackerras writes: > The strlen() in glibc for ppc is unbearably clever hand-coded > assembly, which loads up 8 bytes at a time (once it has the address > 8-byte aligned), and does various ANDs and ORs and ADDs and > conditional branches. If some of the 8 bytes aren't defined, it will > in many cases branch one way or the other based on the undefined > bytes, but end up computing the same result on either branch. This reminds me of what I did in my previous life, writing a memory allocation checker -- this was before Valgrind -- and found out that strcpy in the C library that came with Solaris had a similar clever trick. What was interesting was that copying a string starting at the (PAGESIZE-3)th byte on a page and NUL terminated at the end of the same page ended up prefetching the first word from the next page (please do not ask me about the details -- I do not remember the disassembly of that part of the code anymore). It was not an inconvenience for our memory checker but was a real bug -- the next page could very well be unaccessible. The bug was fixed in the next version of the C library when we updated our Solaris box.