Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: need an advice how to detect a bug

Author: Brian Kostick

Date: 08:26:42 11/03/02

Go up one level in this thread


On November 03, 2002 at 10:38:20, Uri Blass wrote:

>I found that there is a bug in the latest version of movei and it seems based on
>page 130 of the book "the practice of programming" that it is a memory
>allocation error.
>
>I see different behaviour in debug configuration and in release configuration.
>I also saw different behaviour when I only added one printf.
>
>My question is what is the fastest way to detect the bug.
>
>I have a lot of arrays and adding a code to check if I wrote outside the
>allocated memory in every place is a lot of work.
>
>I think that it may be better if the compiler can do it for me(or maybe the
>compiler can do it and I do not know how it can do it).
>
>Is there a reason that prevent the compiler to check only in debug mode that
>what I put in the arrays make sense before putting the information in the
>arrays?
>
>Note that I save previous versions of movei and I may try to compare number of
>nodes in debug mode and release mode to try to find the latest version that has
>the bug but the problem is that I cannot know that I have not the bug from
>identical output and I can only know that I have a bug when the output is not
>identical.
>
>Uri


Hello Uri,

  What you describe is a 'bounds checker'. I think you could web-search for more
detail if interested. I would also mention that some debug builds initialize
memory for you and release often not. For example:

ImageBuffer = malloc(ImageHeight * ScanlineLength + 769);

// this (or similar) may be done by compiler in debug build but not in release
memset(ImageBuffer, 0, ImageHeight * ScanlineLength + 769);

I don't know if this is the trouble for you however I did report something like
this in Gerbil at one time.

Regards,
BK



This page took 0.01 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.