Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Is this a compiler bug?

Author: Daniel Clausen

Date: 15:02:33 10/25/03

Go up one level in this thread


On October 25, 2003 at 17:44:38, Tord Romstad wrote:

>On October 25, 2003 at 15:11:45, Dieter Buerssner wrote:
>
>>On October 25, 2003 at 09:49:58, Tord Romstad wrote:
>>
>>>I compiled without -fbranch-prediction (but this makes the engine much slower).
>>>
>>>After spending a few hours debugging, I found that the crash occurs in the
>>>following
>>>innocent-looking function:
>>
>>Very strange. Did you have a look at the generated assembly with and without
>>-fbranch-prediction for that function?
>
>No, I haven't done that, but it sounds like a good idea.
>
>>Stack overflow should not happen that fast. If the bug really is in that function, one should
>>be able to see it from the assembly. Perhaps another bug is just triggered here.
>
>A bug somewhere else in my code, you mean?  That's what I fear, too (although I
>don't
>understand how a bug somewhere else could be triggered here).  Changing the
>command[]
>array from a local to a global array seems to have solved my problem, but I
>still have
>the nagging fear that the problem was caused by a nasty bug somewhere else in my
>program, and that this bug may have other unpleasant consequences.
>
>Tord

When you have a local array somewhere where you write over its bound and can
destroy your stack, it's not uncommon that you get weird errors on subsequent
function calls. Adding another local variable somewhere (or chaning a local one
to a global one) changes the memory layout on your stack a bit and the error can
occur on another place then. (although it obviously didn't - so far, hehe ;)

Hope you can resolve this problem! Good luck!

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.