|
From: Julian S. <js...@ac...> - 2005-10-18 09:59:23
|
> > well, the xor testcase failure is interesting, because that is indeed a > > real bug (we used to do defined-ness tracking at bitlevel for xor, while > > we never did that for multiplies so far). > > There is (or was) a special case for xor of a register with itself > which caused memcheck to consider the whole thing as defined because > compilers use that trick to generate zero. That case is still there for x86 and amd64. I suspect the reason why it doesn't work here is because program was compiled with no optimisation and so gcc is not emitting 'xorl %reg,%reg' but some other longer sequence which the case doesn't catch. It has friends too now: the MySQL folks discovered that gcc sometimes produces 'sbbl %reg,%reg' which gets the carry flag into %reg and doesn't depend on its previous value. So that is handled similarly. > Other than that I think xor just marks an output bit as defined if > both input bits are defined as the result of xor always depends on > both inputs. Yeh .. I can't think of a more accurate definedness rule which is correct, unfortunately. --- Something I should have mentioned earlier: a good introduction to the definedness analysis in memcheck is available at http://www.valgrind.org/docs/memcheck2005.pdf. J |