Computer Chess Club Archives


Search

Terms

Messages

Subject: optimization-bug in egcs/gcc 2.8.1?

Author: Frank Schneider

Date: 00:13:10 11/30/98


Has anyone had problems with egcs (from CygwinB20) or gcc 2.8.1 and
optimization?

I noticed that Gromit's nodecount to search the initial position to a
fixed depth changed when optimization was enabled with these compilers.
When I use gcc 2.7.2.1 (with or without optimization) or egcs or gcc 2.8.1
(without optimization) I get reproducable results. I had a closer look
at the problem using the CygwinB20 egcs.

Here are some lines of code that caused the problem:


typedef unsigned char FIXED8;
struct searchmove
{
    FIXED8      fromsquare;
    FIXED8      from;
    FIXED8      tosquare;
    FIXED8      to;
};

    short p=... // is ok
    searchmove m;
    m.to = p;
    m.tosquare = EMPTY;

    while (m2)
    {
        short i=board->firstBit(m2);
        m2&=npiecemask[i];

        // I had some cout i,m2,m,... here and everything is fine so far, but

        // the next two statments do not work with optimization!
        m.from = piecetable[i].pos;
        m.fromsquare = piecetable[i].typ;

        // the struct m is corrupted here!

        ...
    }

piecetable[i].pos and piecetable[i].typ are FIXED8 as well, but after the
assignments the searchmove m is corrupted.

Any experiences/explanations?

Frank



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.