PVS-StudioWarnings

PVS-Studio warning V501 for IPP Samples

Nov 13th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. void MeBase::MakeVlcTableDecision()
  2. {
  3.   ...
  4.   Ipp32s BestMV =
  5.     IPP_MIN(IPP_MIN(m_cur.MvRate[0],m_cur.MvRate[1]),
  6.                     IPP_MIN(m_cur.MvRate[2],m_cur.MvRate[3]));
  7.   Ipp32s BestAC =
  8.     IPP_MIN(IPP_MIN(m_cur.AcRate[0],m_cur.AcRate[1]),
  9.                     IPP_MIN(m_cur.AcRate[2],m_cur.AcRate[2]));
  10.   ...
  11. }
  12.  
  13. See the last string. The index at the end should be '3', not '2'. As a result, the error causes the minimum value to be estimated incorrectly at times.
  14.  
  15. This suspicious code was found in IPP Samples project by PVS-Studio static code analyzer.
  16. Warning message is:
  17. V501 There are identical sub-expressions to the left and to the right of the '<' operator: (m_cur.AcRate [2]) < (m_cur.AcRate [2]) me umc_me.cpp 898
  18.  
  19. 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