Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: MSVC code gen bug?

Author: Scott Gasch

Date: 14:31:02 12/31/01

Go up one level in this thread


On December 31, 2001 at 15:47:25, Scott Gasch wrote:

...
>                iIsolated[WHITE] += pHash->iFiles[WHITE][j];
>                ASSERT(iScore[WHITE] < 1500);
>            }
>
>            //
>            // Look for passed pawns...
>            //

!!!>         Trace("&(pHash->iRanks[1][%u]) = %p.\n",
!!!>               j, &(pHash->iRanks[WHITE][j]));

>            i = pHash->iRanks[WHITE][j];
>            ASSERT(i > 1);
>            ASSERT(i < 8);

If I add that one Trace call (marked !!!> above) just above the AV line, the
code works.  It causes the register allocations to change around.  At the new
top of the loop we get:

100236F9   mov         ebx,1
100236FE   mov         dword ptr [esp+28h],ebx
10023702   lea         edi,[esi+2Bh]

So we're using ebx (and esp+28h) instead of ecx (pure register variable, not
present on the stack) as the loop variable and edi as a pointer to the right
place in the pHash struct.  Then the line that used to AV is now:

10023762   xor         edx,edx
10023764   mov         dl,byte ptr [edi]

This works fine.  edi is updated every loop iteration in this version.

How can adding one call to Trace cause this to work if this is not a code gen
bug?  Am I going crazy here?

Scott



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.