tbcore.c problem on RaspPi

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

LocutusOfPenguin
Posts: 34
Joined: Thu Sep 28, 2017 6:52 pm
Location: Karlsruhe, Germany
Full name: Jürgen Précour

tbcore.c problem on RaspPi

Post by LocutusOfPenguin »

Hello,

when i compile several chess programs it seems to me, that alot of them have this tbcore.c file(s) 1:1 included. But there seems to be a problem on ARM gcc.

on my version on line 408 it saying:
static const char offdiag[] = {

but since there are "-1" inside, the arm gcc complains about "narrowing"

I think it should be:
static const signed char offdiag[] = {

or is there another way to get this compile error solved?

Thanks,
JÜrgen
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: tbcore.c problem on RaspPi

Post by syzygy »

You are fully correct. It should have been signed char.
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: tbcore.c problem on RaspPi

Post by jdart »

Fixed (along with other things) in this version:

https://github.com/jdart1/Fathom

--Jon
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: tbcore.c problem on RaspPi

Post by Ras »

LocutusOfPenguin wrote:but since there are "-1" inside, the arm gcc complains about "narrowing"
On ARM, char is unsigned by default, while it is signed on x86. You can change this via a compiler flag (-fsigned-char for GCC).

Making the char signed in the declaration is a cleaner way of fixing it. But actually, char should not be used for anything besides characters. Since C99, the correct datatype here would be int8_t.