{"action":"created","issue":{"url":"https://api.github.com/repos/official-stockfish/Stockfish/issues/1350","repository_url":"https://api.github.com/repos/official-stockfish/Stockfish","labels_url":"https://api.github.com/repos/official-stockfish/Stockfish/issues/1350/labels{/name}","comments_url":"https://api.github.com/repos/official-stockfish/Stockfish/issues/1350/comments","events_url":"https://api.github.com/repos/official-stockfish/Stockfish/issues/1350/events","html_url":"https://github.com/official-stockfish/Stockfish/issues/1350","id":285208778,"number":1350,"title":"30 Dec 2017: PVS-Studio, cppcheck errors and gcc warnings","user":{"login":"d3vv","id":32866346,"avatar_url":"https://avatars3.githubusercontent.com/u/32866346?v=4","gravatar_id":"","url":"https://api.github.com/users/d3vv","html_url":"https://github.com/d3vv","followers_url":"https://api.github.com/users/d3vv/followers","following_url":"https://api.github.com/users/d3vv/following{/other_user}","gists_url":"https://api.github.com/users/d3vv/gists{/gist_id}","starred_url":"https://api.github.com/users/d3vv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d3vv/subscriptions","organizations_url":"https://api.github.com/users/d3vv/orgs","repos_url":"https://api.github.com/users/d3vv/repos","events_url":"https://api.github.com/users/d3vv/events{/privacy}","received_events_url":"https://api.github.com/users/d3vv/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-12-30T15:43:26Z","updated_at":"2018-01-01T17:55:29Z","closed_at":null,"author_association":"NONE","body":"**GCC 5.1.0 WARNINGS:**\r\n\r\nsyzygy/tbprobe.cpp: In function 'T {anonymous}::probe_table(const Position&, Tablebases::ProbeState*, Tablebases::WDLScore) [with E = {anonymous}::WDLEntry; T = Tablebases::WDLScore]':\r\nsyzygy/tbprobe.cpp:760:30: warning: array subscript is above array bounds [-Warray-bounds]\r\n             if (d->pieces[i] == pieces[j])\r\n                              ^\r\nsyzygy/tbprobe.cpp: In function 'int Tablebases::probe_dtz(Position&, Tablebases::ProbeState*)':\r\nsyzygy/tbprobe.cpp:760:30: warning: array subscript is above array bounds [-Warray-bounds]\r\n             if (d->pieces[i] == pieces[j])\r\n                              ^\r\n\r\n**CPPCHECK:**\r\n\r\n[Stockfish/src/psqt.cpp:112]: (error) Array index -2 is out of bounds.\r\n      PieceValue[MG][~pc] = PieceValue[MG][pc];\r\n\r\n[Stockfish/src/psqt.cpp:113]: (error) Array index -2 is out of bounds.\r\n      PieceValue[EG][~pc] = PieceValue[EG][pc];\r\n\r\n[Stockfish/src/psqt.cpp:121]: (error) Array index -1 is out of bounds.\r\n          psq[~pc][~s] = -psq[pc][s];\r\n\r\n[Stockfish/src/syzygy/tbprobe.cpp:415]: (error) Using 'memset' on struct that contains a 'std::atomic_bool'.\r\n    memset(this, 0, sizeof(WDLEntry));\r\n\r\n[Stockfish/src/syzygy/tbprobe.cpp:456]: (error) Using 'memset' on struct that contains a 'std::atomic_bool'.\r\n    memset(this, 0, sizeof(DTZEntry));\r\n\r\n\r\n**PVS-STUDIO:**\r\n\r\n/home/dew/Stockfish/src/bitbase.cpp     127     err     V557 Array underrun is possible. The '~us' index is pointing beyond array bound.\r\n            && (    distance(ksq[~us], psq + NORTH) > 1\r\n\r\n/home/dew/Stockfish/src/bitbase.cpp     133     err     V557 Array underrun is possible. The '~us' index is pointing beyond array bound.\r\n            && (  !(PseudoAttacks[KING][ksq[us]] & ~(PseudoAttacks[KING][ksq[~us]] | PawnAttacks[~us][psq]))\r\n\r\n/home/dew/Stockfish/src/bitbase.cpp     134     err     V557 Array underrun is possible. The '~us' index is pointing beyond array bound.\r\n                 || (PseudoAttacks[KING][ksq[us]] & psq & ~PseudoAttacks[KING][ksq[~us]])))\r\n\r\n/home/dew/Stockfish/src/bitboard.h      215     err     V557 Array overrun is possible. The 'pawn_passed' function processes value '[-2..-1]'. Inspect the first argument. Check lines: 'bitboard.h:215', 'position.h:312', 'evaluate.cpp:808'.\r\n  return PassedPawnMask[c][s];\r\n\r\n/home/dew/Stockfish/src/movepick.cpp    70      err     V730 Not all members of a class are initialized inside the constructor. Consider inspecting: cur, endMoves, endBadCaptures, recaptureSquare, threshold, moves.\r\nMovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHistory* mh,\r\n\r\n/home/dew/Stockfish/src/search.cpp      554     err     V629 Consider inspecting the 'excludedMove << 16' expression. Bit shifting of the 32-bit value with a subsequent expansion to the 64-bit type.\r\n    posKey = pos.key() ^ Key(excludedMove << 16); // isn't a very good hash\r\n\r\n/home/dew/Stockfish/src/ucioption.cpp   106     err     V730 Not all members of a class are initialized inside the constructor. Consider inspecting: idx.\r\nOption::Option(const char* v, OnChange f) : type(\"string\"), min(0), max(0), on_change(f)\r\n\r\n/home/dew/Stockfish/src/ucioption.cpp   109     err     V730 Not all members of a class are initialized inside the constructor. Consider inspecting: idx.\r\nOption::Option(bool v, OnChange f) : type(\"check\"), min(0), max(0), on_change(f)\r\n\r\n/home/dew/Stockfish/src/ucioption.cpp   112     err     V730 Not all members of a class are initialized inside the constructor. Consider inspecting: idx.\r\nOption::Option(OnChange f) : type(\"button\"), min(0), max(0), on_change(f)\r\n\r\n/home/dew/Stockfish/src/ucioption.cpp   115     err     V730 Not all members of a class are initialized inside the constructor. Consider inspecting: idx.\r\nOption::Option(int v, int minv, int maxv, OnChange f) : type(\"spin\"), min(minv), max(maxv), on_change(f)\r\n\r\n/home/dew/Stockfish/src/syzygy/tbprobe.cpp      759     err     V791 The initial value of the index in the nested loop equals 'i'. Perhaps, 'i + 1' should be used instead.\r\n        for (int j = i; j < size; ++j)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/official-stockfish/Stockfish/issues/comments/354666296","html_url":"https://github.com/official-stockfish/Stockfish/issues/1350#issuecomment-354666296","issue_url":"https://api.github.com/repos/official-stockfish/Stockfish/issues/1350","id":354666296,"user":{"login":"DU-jdto","id":6344802,"avatar_url":"https://avatars2.githubusercontent.com/u/6344802?v=4","gravatar_id":"","url":"https://api.github.com/users/DU-jdto","html_url":"https://github.com/DU-jdto","followers_url":"https://api.github.com/users/DU-jdto/followers","following_url":"https://api.github.com/users/DU-jdto/following{/other_user}","gists_url":"https://api.github.com/users/DU-jdto/gists{/gist_id}","starred_url":"https://api.github.com/users/DU-jdto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DU-jdto/subscriptions","organizations_url":"https://api.github.com/users/DU-jdto/orgs","repos_url":"https://api.github.com/users/DU-jdto/repos","events_url":"https://api.github.com/users/DU-jdto/events{/privacy}","received_events_url":"https://api.github.com/users/DU-jdto/received_events","type":"User","site_admin":false},"created_at":"2018-01-01T17:55:29Z","updated_at":"2018-01-01T17:55:29Z","author_association":"NONE","body":"Look at what the overloads actually are. ~pc is the same as (pc ^ 8), and ~s is the same as (s ^ 56). It is mathematically impossible to get a negative result from a positive input to either, as neither 8 nor 56 have the msb set."}}
{"actor":{"display_login":"DU-jdto"}}