TerjeKir / weiss

Weiss - a UCI chess engine
GNU General Public License v3.0
99 stars 18 forks source link

Fix mixed-signedness comparison #678

Closed skiminki closed 10 months ago

skiminki commented 10 months ago

GCC 13 has made checks for mixed-signedness comparisons more stringent, causing a build failure on Ubuntu 23.10 (pre-release). Workaround this by adding some casts in the Pyrrhic code.

Fixes #677

No functional change.

**

Note: This is perhaps not the cleanest possible fix, but it is the smallest one. Possibly, a better fix would be something such as:

typedef enum {

    PYRRHIC_BLACK   = 0, PYRRHIC_WHITE   = 1,
    PYRRHIC_PAWN    = 1, PYRRHIC_KNIGHT  = 2,
    PYRRHIC_BISHOP  = 3, PYRRHIC_ROOK    = 4,
    PYRRHIC_QUEEN   = 5, PYRRHIC_KING    = 6

} PyrrhicPieces;

for (PyrrhicPieces i = PYRRHIC_PAWN; i <= PYRRHIC_KING; i++)
{
   ...
}

That is, break the big anonymous enum type to smaller enum types of related values. That would allow for more consistent use of types in expressions. However, I'm not entirely sure what is the intended direction here, and you could also argue that the code is just fine as it is and GCC is just overly stringent here.

Bench: 22069011

TerjeKir commented 10 months ago

Much appreciated as always! <3