Bug found in OliThink 5.1.9 => Corrected code (5.2.0) onl

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
OliverBr
Posts: 237
Joined: Tue Dec 18, 2007 8:38 pm
Location: Munich, Germany
Contact:

Bug found in OliThink 5.1.9 => Corrected code (5.2.0) onl

Post by OliverBr » Fri Sep 18, 2009 4:30 pm

Hello...

While translation Olithink 5.1.9 source code into Java I found a severe bug in OliThink 5.1.9

I corrected the bug and released a new Version 5.2.0 and put it online on my homepage:

http://home.arcor.de/dreamlike/chess/index.html

Unfortunately I do not have any Windows Compiler installed. If someone here could help me out and compile OliThink for Windows32 and Windows64. Please provide an optimized and stripped Executable.
Thank You.

PS:
in search() the following line:

Code: Select all

else if (PIECE(m) == PAWN && ((TO(m) & 48) == 48  || TO(m) & 48) == 0) ext++; //Pawn short to promote
Was plain NONSENSE. Unfortunately C does not complain about the senseless stuff while Java does. So I found the error and the line must be:

Code: Select all

else if (PIECE(m) == PAWN && ((TO(m) & 48) == 48  || (TO(m) & 48) == 0)) ext++; //Pawn short to promote

User avatar
Jim Ablett
Posts: 1327
Joined: Fri Jul 14, 2006 5:56 am
Location: London, England
Contact:

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by Jim Ablett » Fri Sep 18, 2009 6:42 pm

Image
OliThink 5.2.0 JA by Oliver Brausch

Windows win32 & x64 Msvc p.g.o builds.

Download:
http://www.mediafire.com/?zr2ddidkzjz


Jim.

User avatar
michiguel
Posts: 6264
Joined: Thu Mar 09, 2006 7:30 pm
Location: Chicago, Illinois, USA
Contact:

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by michiguel » Fri Sep 18, 2009 7:55 pm

OliverBr wrote:Hello...

While translation Olithink 5.1.9 source code into Java I found a severe bug in OliThink 5.1.9

I corrected the bug and released a new Version 5.2.0 and put it online on my homepage:

http://home.arcor.de/dreamlike/chess/index.html

Unfortunately I do not have any Windows Compiler installed. If someone here could help me out and compile OliThink for Windows32 and Windows64. Please provide an optimized and stripped Executable.
Thank You.

PS:
in search() the following line:

Code: Select all

else if (PIECE(m) == PAWN && ((TO(m) & 48) == 48  || TO(m) & 48) == 0) ext++; //Pawn short to promote
Was plain NONSENSE. Unfortunately C does not complain about the senseless stuff while Java does. So I found the error and the line must be:

Code: Select all

else if (PIECE(m) == PAWN && ((TO(m) & 48) == 48  || (TO(m) & 48) == 0)) ext++; //Pawn short to promote
If you turn on the warnings, most C compilers will scream if they see (A & B == C) rather than ((A & B) == C).

Miguel

User avatar
Graham Banks
Posts: 30733
Joined: Sun Feb 26, 2006 9:52 am
Location: Auckland, NZ

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by Graham Banks » Fri Sep 18, 2009 8:27 pm

Hi Oliver,

I'm glad you found the bug. Hopefully OliThink won't give away a rook or queen for nothing now, as it was doing every tenth game or so.

Cheers,
Graham.
My email addresses:
gbanksnz at gmail.com
gbanksnz at yahoo.co.nz

OliverBr
Posts: 237
Joined: Tue Dec 18, 2007 8:38 pm
Location: Munich, Germany
Contact:

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by OliverBr » Sat Sep 19, 2009 6:10 am

Graham Banks wrote:Hi Oliver,

I'm glad you found the bug. Hopefully OliThink won't give away a rook or queen for nothing now, as it was doing every tenth game or so.

Cheers,
Graham.
Hi Graham, it's actually only *a* bug, I don't except it will change this strange behaviour at your tests, but we will eventually see.

Thanks anyway.

OliverBr
Posts: 237
Joined: Tue Dec 18, 2007 8:38 pm
Location: Munich, Germany
Contact:

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by OliverBr » Sat Sep 19, 2009 6:22 am

michiguel wrote:
If you turn on the warnings, most C compilers will scream if they see (A & B == C) rather than ((A & B) == C).

Miguel
Neither gcc, nor Visual Studio complained about it (with warnings on, of course).

OliverBr
Posts: 237
Joined: Tue Dec 18, 2007 8:38 pm
Location: Munich, Germany
Contact:

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by OliverBr » Sat Sep 19, 2009 6:45 am

Jim Ablett wrote:Image
OliThink 5.2.0 JA by Oliver Brausch

Windows win32 & x64 Msvc p.g.o builds.

Download:
http://www.mediafire.com/?zr2ddidkzjz


Jim.
Thanks a lot, Jim.

Executables are now ready for download:

http://home.arcor.de/dreamlike/chess/index.html

User avatar
michiguel
Posts: 6264
Joined: Thu Mar 09, 2006 7:30 pm
Location: Chicago, Illinois, USA
Contact:

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by michiguel » Sat Sep 19, 2009 8:36 am

OliverBr wrote:
michiguel wrote:
If you turn on the warnings, most C compilers will scream if they see (A & B == C) rather than ((A & B) == C).

Miguel
Neither gcc, nor Visual Studio complained about it (with warnings on, of course).
You are right

Code: Select all

#include <stdio.h>

#define PIECE&#40;m&#41; m
#define TO&#40;m&#41; m
#define PAWN 1

int main &#40;void&#41;
&#123;
	int m=1;
	int ext = 0;
#if 1
	if &#40;PIECE&#40;m&#41; == PAWN && (&#40;TO&#40;m&#41; & 48&#41; == 48  || TO&#40;m&#41; & 48&#41; == 0&#41; ext++;
#else
	if &#40;PIECE&#40;m&#41; == PAWN && (&#40;TO&#40;m&#41; & 48&#41; == 48  || &#40;TO&#40;m&#41; & 48&#41; == 0&#41;) ext++;
#endif
	printf ("ext=%d\n", ext&#41;;
	return 0;
&#125;
GCC gives no warning in either case with
gcc -Wall -Wextra temp.c -o temp
:shock:

However splint detects it

First version:

Code: Select all

Splint 3.1.2 --- 07 May 2008

temp.c&#58; &#40;in function main&#41;
temp.c&#58;13&#58;36&#58; Right operand of || is non-boolean &#40;int&#41;&#58;
                 &#40;m & 48&#41; == 48 || m & 48
  The operand of a boolean operator is not a boolean. Use +ptrnegate to allow !
  to be used on pointers. &#40;Use -boolops to inhibit warning&#41;

Finished checking --- 1 code warning
Corrected version:

Code: Select all

Splint 3.1.2 --- 07 May 2008

Finished checking --- no warnings
This must be some sort of pathological case for the warning detection. As I said, if I include

if (TO(m) & 48 == 0)
ext++;

I get with gcc -Wall -Wextra temp.c -o temp

temp.c: In function ‘main’:
temp.c:17: warning: suggest parentheses around comparison in operand of &

Miguel
PS: Note to myself => I have to keep using splint!!

OliverBr
Posts: 237
Joined: Tue Dec 18, 2007 8:38 pm
Location: Munich, Germany
Contact:

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by OliverBr » Sat Sep 19, 2009 1:37 pm

Hmm, actually the line works fine. Too fine!

There is now too much extension now and thus the search depth lower.
I have to release a 5.2.1 version soon with just that line completely removed.

:(

OliverBr
Posts: 237
Joined: Tue Dec 18, 2007 8:38 pm
Location: Munich, Germany
Contact:

Re: Bug found in OliThink 5.1.9 => Corrected code (5.2.0)

Post by OliverBr » Sat Sep 19, 2009 2:07 pm

Update: I made now a 5.2.1 and released the source. Before I ask you for help compiling it, I will do some tests on a linux machine first.

Thank you for your support.

Post Reply