🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.chess
Article #1751

Bugs in 5.04

#1751
From: Martin Vorlaender
Date: Tue, 19 Mar 2002 05:18
78 lines
3653 bytes
Hi,

out of curiosity I tried to port GNU chess 5.04 to OpenVMS. It was very
easy (just the usual hoops you have to go through with an autoconf'ed
project - hand-craft config.h and a makefile), and compiled cleanly with
Compaq C (very picky!) 6.4 under OpenVMS 7.2-1H1. The compiler only
pointed at two things which I think are bugs:

          SANMove(pvar[2],2);
.......................^
%CC-I-SUBSCRBOUNDS, In this statement, an array is being accessed outside
 the bounds specified for the array type.
at line number 583 in file <path>CMD.C;1

  memset(playerdb,0,sizeof(playerdb[MAXPLAYERS]));
..^
%CC-I-SUBSCRBOUNDS, In this statement, an array is being accessed outside
 the bounds specified for the array type.
at line number 184 in file <path>PLAYERS.C;1

When running it crashed on me, but at another place, which I remedied by
the first patch below. Even if I don't fully understand what's going on
in the location of the first message above, here's my suggestion on what
to change:

diff -urdN gnuchess-5_04/src/cmd.c gnuchess-5_04-vms/src/cmd.c
--- gnuchess-5_04/src/cmd.c	Wed Mar  6 22:10:42 2002
+++ gnuchess-5_04-vms/src/cmd.c	Mon Mar 18 03:39:25 2002
@@ -189,7 +189,7 @@
    sprintf(inputstr,"%s %s %s",subcmd,setting,subsetting);
 
    trim = inputstr + strlen(inputstr) - 1;
-   while (*trim==' ' && trim>=inputstr)
+   while (trim>=inputstr && *trim==' ')
                 *trim--='\0';
 
    if (strcmp (cmd, "quit") == 0 || strcmp (cmd, "exit") == 0)
@@ -574,13 +574,13 @@
      int pvar[2];
      if ((flags & USEHASH))
      {
-        if (TTGetPV(board.side,2,rootscore,&pvar[2]))
+        if (TTGetPV(board.side,2,rootscore,&pvar[0]))
         {
 	  /* Find all moves for ambiguity checks */
 	  /* Otherwise xboard complains at ambiguous hints */
 	  GenMoves(2); 
 
-          SANMove(pvar[2],2);
+          SANMove(pvar[0],2);
           printf("Hint: %s\n", SANmv);
           fflush(stdout);
 	}
diff -urdN gnuchess-5_04/src/players.c gnuchess-5_04-vms/src/players.c
--- gnuchess-5_04/src/players.c	Thu Feb  7 01:46:26 2002
+++ gnuchess-5_04-vms/src/players.c	Mon Mar 18 02:55:54 2002
@@ -181,7 +181,7 @@
 	p++;
   } while (*p != '\0');
   *x = '\000';
-  memset(playerdb,0,sizeof(playerdb[MAXPLAYERS]));
+  memset(playerdb,0,sizeof(playerdb));
   DBReadPlayer ();
   index = DBSearchPlayer (lname);
   if (index == -1) {
[End of patch]

cu,
  Martin

P.S.: Before anyone asks: xboard is giving me a harder time. I'll have
to get an X Windows source distribution for the Xaw and Xmu libraries
first.
-- 
So long, and thanks        | Martin Vorlaender  |  VMS & WNT programmer
for all the books...       | work: mv@pdv-systeme.de
In Memoriam Douglas Adams  |       http://www.pdv-systeme.de/users/martinv/
            1952-2001      | home: martin@radiogaga.harz.de
Technical Details
Message-ID: <3c96ca0a.524144494f47414741@radiogaga.harz.de>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-han1.dfn.de!news.rz.tu-clausthal.de!news.harz.de!news.harz.de!radiogaga!radiogaga.harz.de!martin

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d71d,ffa41453e1242b3b,start
X-Google-Attributes: gid10d71d,public
X-Google-ArrivalTime: 2002-03-18 21:55:10 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-han1.dfn.de!news.rz.tu-clausthal.de!news.harz.de!news.harz.de!radiogaga!radiogaga.harz.de!martin
From: martin@radiogaga.harz.de (Martin Vorlaender)
Newsgroups: gnu.chess
Subject: Bugs in 5.04
Distribution: world
Message-ID: <3c96ca0a.524144494f47414741@radiogaga.harz.de>
Date: Tue, 19 Mar 2002 06:18:02 +0100
Reply-To: martin@radiogaga.harz.de
Organization: home
X-Newsreader: TIN [version 1.2 PL2]
X-Posting-Software: UUPC/extended 1.13f inews (25Nov98 07:59)
Lines: 78