PVS-StudioWarnings

PVS-Studio warning V610 for MesaLib

Nov 27th, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #define MAX_VARYING 32
  2.  
  3. typedef enum
  4. {
  5.   ....
  6.   FRAG_ATTRIB_VAR0 = 16,
  7.   FRAG_ATTRIB_MAX = (FRAG_ATTRIB_VAR0 + MAX_VARYING)
  8. } gl_frag_attrib;
  9.  
  10. static inline GLuint
  11. clip_span( struct gl_context *ctx, SWspan *span )
  12. {
  13.   ....
  14.   for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
  15.     if (span->interpMask & (1 << i)) {
  16.   ....
  17. }
  18.  
  19. This suspicious code was found in MesaLib project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V610 Undefined behavior. Check the shift operator '<<. The right operand ('i' = [0..47]) is greater than or equal to the length in bits of the promoted left operand. s_span.c 768
  22.  
  23. 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