Advertisement
PVS-StudioWarnings

PVS-Studio warning V501 for MAME

Nov 27th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. WRITE16_HANDLER( deco16_104_prot_w )
  2. {
  3.   ...
  4.   if (offset != (0x150 >> 1) &&
  5.       offset != (0x0 >> 1) &&
  6.       offset != (0x110 >> 1) &&
  7.       offset != (0x280 >> 1) &&
  8.       offset != (0x290 >> 1) &&
  9.       offset != (0x2b0 >> 1) &&
  10.       offset != (0x370 >> 1) &&   <<<---
  11.       offset != (0x3c0 >> 1) &&   <<<===
  12.       offset != (0x370 >> 1) &&   <<<---
  13.       offset != (0x3c0 >> 1) &&   <<<===
  14.       offset != (0x430 >> 1) &&
  15.       offset != (0x460 >> 1) &&
  16.       offset != (0x5a0 >> 1) &&
  17.       offset != (0x5b0 >> 1) &&
  18.       offset != (0x6e0 >> 1) &&
  19.       offset != (0x7d0 >> 1)
  20.   )
  21.   ...
  22. }
  23.  
  24. This suspicious code was found in MAME project by PVS-Studio static code analyzer.
  25. Warning message is:
  26. V501 There are identical sub-expressions 'offset != (0x370 >> 1)' to the left and to the right of the '&&' operator.  decoprot.c 118
  27.  
  28. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement