Hmm, are you sure this isn't a bug in Valgrind itself? The code it's warning on is this:
inline static void wine_ldt_set_limit( LDT_ENTRY *ent, unsigned int limit ) { if ((ent->HighWord.Bits.Granularity = (limit >= 0x100000))) limit >>= 12; ent->LimitLow = (WORD)limit; ent->HighWord.Bits.LimitHi = (limit >> 16); }
but unless I'm reading it wrong this is not testing ent before initialization at all, it's testing limit, assigning to ent, then testing the result of that assignment ... which seems to be valid.
Of course, working around bugs in Valgrind may be a useful thing to do for now ... that code is seriously terrifying stuff. And I thought Wine was scary :)
thanks -mike
Mike Hearn wrote:
Hmm, are you sure this isn't a bug in Valgrind itself? The code it's warning on is this:
inline static void wine_ldt_set_limit( LDT_ENTRY *ent, unsigned int limit ) { if ((ent->HighWord.Bits.Granularity = (limit >= 0x100000))) limit >>= 12; ent->LimitLow = (WORD)limit; ent->HighWord.Bits.LimitHi = (limit >> 16); }
but unless I'm reading it wrong this is not testing ent before initialization at all, it's testing limit, assigning to ent, then testing the result of that assignment ... which seems to be valid.
Of course, working around bugs in Valgrind may be a useful thing to do for now ... that code is seriously terrifying stuff. And I thought Wine was scary :)
Dan there were some late fixes in valgrind about bit manipulation insn:s (yesterday or so IIRC). This could be related. You may want to check out valgrind's svn. A+
On Sat, May 13, 2006 at 11:11:50PM +0100, Mike Hearn wrote:
if ((ent->HighWord.Bits.Granularity = (limit >= 0x100000)))
but unless I'm reading it wrong this is not testing ent before initialization at all, it's testing limit, assigning to ent, then testing the result of that assignment ... which seems to be valid.
Of course it is testing "ent" by accessing a member of it, thus dereferencing it.
Leslie
On 5/14/06, leslie.polzer@gmx.net leslie.polzer@gmx.net wrote:
Of course it is testing "ent" by accessing a member of it, thus dereferencing it.
ent is initialized here OK, it's correctly pointing to an LDT_ENTRY struct on the stack. Valgrind is (presumably) complaining about ent->HighWord.Bits.Granularity being tested before being assigned, but that's wrong and is either a mistake in:
a) My thinking (quite likely) b) Valgrind c) GCC
thanks -mike
"Mike Hearn" mike@plan99.net writes:
ent is initialized here OK, it's correctly pointing to an LDT_ENTRY struct on the stack. Valgrind is (presumably) complaining about ent->HighWord.Bits.Granularity being tested before being assigned, but that's wrong and is either a mistake in:
a) My thinking (quite likely) b) Valgrind c) GCC
It's a valgrind bug. There are some uninitialized bits in the variable, but the bit that the code is testing is initialized properly.