]> git.sesse.net Git - stockfish/commitdiff
Fix a (bogus) warning with gcc 4.4
authorMarco Costalba <mcostalba@gmail.com>
Mon, 16 Jan 2012 09:11:52 +0000 (10:11 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 16 Jan 2012 18:26:42 +0000 (19:26 +0100)
Fix an incorrect warning: 'bm may be used uninitialized'
with the old but still commonly used gcc 4.4

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/search.cpp

index 48cb4d6bdd9df3a36bacff4d04b3ce0dfd5dac34..5440dd1e29482709587289db67ce70ae62b96e61 100644 (file)
@@ -249,7 +249,6 @@ void Search::think() {
 
   static Book book; // Defined static to initialize the PRNG only once
 
-  Move bm;
   Position& pos = RootPosition;
   Chess960 = pos.is_chess960();
   elapsed_time(true);
@@ -266,12 +265,15 @@ void Search::think() {
       goto finalize;
   }
 
-  if (   Options["OwnBook"]
-      && (bm = book.probe(pos, Options["Book File"], Options["Best Book Move"])) != MOVE_NONE
-      && count(RootMoves.begin(), RootMoves.end(), bm))
+  if (Options["OwnBook"])
   {
-      std::swap(RootMoves[0], *find(RootMoves.begin(), RootMoves.end(), bm));
-      goto finalize;
+      Move bookMove = book.probe(pos, Options["Book File"], Options["Best Book Move"]);
+
+      if (bookMove && count(RootMoves.begin(), RootMoves.end(), bookMove))
+      {
+          std::swap(RootMoves[0], *find(RootMoves.begin(), RootMoves.end(), bookMove));
+          goto finalize;
+      }
   }
 
   // Read UCI options: GUI could change UCI parameters during the game