Advertisement
PVS-StudioWarnings

PVS-Studio warning V547 for Firefox

Nov 27th, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. const SafepointIndex *
  2. IonScript::getSafepointIndex(uint32_t disp) const
  3. {
  4.   ....
  5.   size_t minEntry = 0;
  6.   ....
  7.   size_t guess = ....;
  8.   ....
  9.   while (--guess >= minEntry) {
  10.     guessDisp = table[guess].displacement();
  11.     JS_ASSERT(guessDisp >= disp);
  12.     if (guessDisp == disp)
  13.       return &table[guess];
  14.   }
  15.   ....
  16. }
  17.  
  18. This suspicious code was found in Firefox project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V547 Expression '-- guess >= minEntry' is always true. Unsigned type value is always >= 0. ion.cpp 1112
  21.  
  22. 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