Computer Chess Club Archives


Search

Terms

Messages

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

Author: Daniel Clausen

Date: 09:18:59 05/06/04

Go up one level in this thread


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

[snip]

>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.

These things usually indicate that you somehow destroy your stack. (for example
by a buffer overrun) At least in C/C++, I can't speak for Java.


>This problem does not appear with optimization off.

As the memory layout w/ and w/o optimization can differ quite a bit, that can
happen.


>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.

A lot is possible. But in 99.9% of all cases it's the code, not the compiler.
(ack, I shouldn't post numbers in CCC or I will be quoted in the future :D)

Sargon



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.