PVS-StudioWarnings

PVS-Studio warning V610 for V8

Nov 17th, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. template <> struct SmiTagging<8> {
  2.  
  3.   static const int kSmiShiftSize = 31;
  4.   static const int kSmiValueSize = 32;
  5.  
  6.   V8_INLINE static int SmiToInt(internal::Object* value) {
  7.     int shift_bits = kSmiTagSize + kSmiShiftSize;
  8.     return static_cast<int>(reinterpret_cast<intptr_t>(value) >>
  9.       shift_bits);
  10.   }
  11.   ....
  12. }
  13.  
  14. This suspicious code was found in V8 project by PVS-Studio static code analyzer.
  15. Warning message is:
  16. V610 Undefined behavior. Check the shift operator '>>. The right operand 'shift_bits' is greater than or equal to the length in bits of the promoted left operand. v8.h 5343
  17.  
  18. 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