tbcore.c problem on RaspPi

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Post Reply
LocutusOfPenguin
Posts: 18
Joined: Thu Sep 28, 2017 4:52 pm
Location: Karlsruhe, Germany
Contact:

tbcore.c problem on RaspPi

Post by LocutusOfPenguin » Fri Nov 10, 2017 7:31 am

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: 4167
Joined: Tue Feb 28, 2012 10:56 pm

Re: tbcore.c problem on RaspPi

Post by syzygy » Fri Nov 10, 2017 7:47 am

You are fully correct. It should have been signed char.

jdart
Posts: 3476
Joined: Fri Mar 10, 2006 4:23 am
Location: http://www.arasanchess.org

Re: tbcore.c problem on RaspPi

Post by jdart » Fri Nov 10, 2017 5:55 pm

Fixed (along with other things) in this version:

https://github.com/jdart1/Fathom

--Jon

Ras
Posts: 922
Joined: Tue Aug 30, 2016 6:19 pm
Contact:

Re: tbcore.c problem on RaspPi

Post by Ras » Fri Nov 10, 2017 8:26 pm

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.

Post Reply