Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: MSVC code gen bug?

Author: Vincent Diepeveen

Date: 09:58:21 01/01/02

Go up one level in this thread


On January 01, 2002 at 12:46:05, Rafael Andrist wrote:

Yes because of those compiler bugs and also even more my own
casting mistakes i threw out all 8 bits code!

I felt a reborn man afterwards, all the weird symptons and diseases
were gone then!

>>Meanwhile it has never put &pHash on the stack and in the offending line above
>>it generates this code:
>>
>>1002374A   mov         edi,dword ptr [esp+24h]   // get pHash? pHash+20h? what?
>>1002374E   xor         edx,edx
>>10023750   mov         dl,byte ptr [edi+ecx+0Ah] // boom
>>
>>The address of pHash is still sitting in esi at this point.  It could very well
>>have generated code that looked like this:
>>
>>xor edx,edx
>>mov edx,byte ptr [esi+ecx+20h]
>
>That wouldn't work.
>either:
>mov dl, byte ptr [esi+ecx+20h]
>or:
>mov edx, dword ptr [esi+ecx+20h]
>(if the compiler generates this in your case, then it has surely a bug and it
>will cause an access violation)
>
>>What it instead reads from the stack into edi is NULL.  The address of pHash is
>>nowhere on the stack as it has never been written there.  Even if the address of
>>pHash magically somehow got into edi, the expression [edi+ecx+0Ah] would not
>>equate to pHash->iRanks[WHITE][j].  For that to work edi needs to be the address
>>of the start of the iRanks array in pHash... or &pHash + 20h.
>
>what block size for structures are you using? 8 Byte?
>
>Rafael B. Andrist



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.