Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: To Experienced Java Programmers: strange BUG!!

Author: Bernd Nürnberger

Date: 08:42:57 05/06/04

Go up one level in this thread


On May 06, 2004 at 10:19:49, Marek Strejczek wrote:

>>--- snip ---
>>
>>      ...
>>      blackLegalMoves = board.whitePieces;   // captures
>>
>>      ...
>>      // k -- black king
>>      /////////////////////
>>
>>      // o  normal moves and captures
>>      from = board.blackKing;
>>       //    (*)
>>      mvboard = KING_MOVES[from] & blackLegalMoves;
>>      halfply = from | Move.BPC_KING;
>>      while (mvboard != 0L) {
>>        to = Bitboard.last(mvboard);
>>        mvboard &= Bitboard.CLEAR_MASK[to];
>>        moves[mvidx++] = halfply | to << Move.TO | piece[to] << Move.CAPTY;
>>      }
>>
>>--- snap ---
>>
>>if I insert System.out.println(blackLegalMoves); at point (*) and similiar
>>points in the code, the error is not present -- even more strange!?!
>>
>>what can here go wrong with longs? code for other piece types is
>>similiar...
>>
>>Greetings,
>>           Bernd
>
>I've noticed a similar weird behaviour in C++ Builder 5, in the part of my code
>that initializes various bitboard masks. It does it inside nested loops, and
>when I compile the program with optimization setting on I have some (not all)
>masks corrupted. However, if I add a line
>
>cout << "";
>
>after some for(...) lines then the results are correct.
>This problem does not appear with optimization off.
>Maybe the nature of the problem is similar? I suppose that the compiler mixes
>something with registers, and the function call like operator<< may clean it up.
>But I'm not a compiler expert...
>
>Regards
>Marek Strejczek

Yes, I have had some similiar problems with some initialization and
added System.out.flush()   %-)    But the problem I have now is more
severe, because I cannot simply add such a function between every
move generated because if I do that, my performance would drop by
"dimensions".  Probably I will have to debug this in detail :-(

Greets,
       Bernd





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.