From 07f759394b8bf08e8f2eef234ba4917697ff7c57 Mon Sep 17 00:00:00 2001 From: Sami Kiminki <46296557+skiminki@users.noreply.github.com> Date: Tue, 5 Sep 2023 18:30:48 +0300 Subject: [PATCH] Pyrrhic: Fix mixed-signedness comparison (#678) 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. --- src/pyrrhic/tbchess.c | 2 +- src/pyrrhic/tbprobe.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pyrrhic/tbchess.c b/src/pyrrhic/tbchess.c index 1fae6e5e..32264276 100644 --- a/src/pyrrhic/tbchess.c +++ b/src/pyrrhic/tbchess.c @@ -106,7 +106,7 @@ static uint64_t pyrrhic_pieces_by_type(const PyrrhicPosition *pos, int colour, i static int pyrrhic_char_to_piece_type(char c) { - for (int i = PYRRHIC_PAWN; i <= PYRRHIC_KING; i++) + for (int i = PYRRHIC_PAWN; i <= (int)PYRRHIC_KING; i++) if (c == pyrrhic_piece_to_char[i]) return i; return 0; diff --git a/src/pyrrhic/tbprobe.c b/src/pyrrhic/tbprobe.c index 1719deb0..0d74e994 100644 --- a/src/pyrrhic/tbprobe.c +++ b/src/pyrrhic/tbprobe.c @@ -445,13 +445,13 @@ static void prt_str(const PyrrhicPosition *pos, char *str, int flip) { int color = flip ? PYRRHIC_BLACK : PYRRHIC_WHITE; - for (int pt = PYRRHIC_KING; pt >= PYRRHIC_PAWN; pt--) + for (int pt = PYRRHIC_KING; pt >= (int)PYRRHIC_PAWN; pt--) for (int i = PYRRHIC_POPCOUNT(pyrrhic_pieces_by_type(pos, color, pt)); i > 0; i--) *str++ = pyrrhic_piece_to_char[pt]; *str++ = 'v'; - for (int pt = PYRRHIC_KING; pt >= PYRRHIC_PAWN; pt--) + for (int pt = PYRRHIC_KING; pt >= (int)PYRRHIC_PAWN; pt--) for (int i = PYRRHIC_POPCOUNT(pyrrhic_pieces_by_type(pos, color^1, pt)); i > 0; i--) *str++ = pyrrhic_piece_to_char[pt]; *str++ = 0;