Examples of errors detected by the V610 diagnostic

<< Return to list of all diagnostics

V610. Undefined behavior. Check the shift operator.


lib7z

V610 Undefined behavior. Check the shift operator '<<. The right operand ('(8 * i)' = [0..56]) is greater than or equal to the length in bits of the promoted left operand. lib7z 7zin.c 233


SZ_RESULT SafeReadDirectUInt64(ISzInStream *inStream,
                               UInt64 *value)
{
  int i;
  *value = 0;
  for (i = 0; i < 8; i++)
  {
    Byte b;
    RINOK(SafeReadDirectByte(inStream, &b));
    *value |= ((UInt32)b << (8 * i));
  }
  return SZ_OK;
}

Game_Music_Emu library

V610 Undefined behavior. Check the shift operator '<<. The left operand '~0x2F00' is negative. game-music-emu spc_cpu.cpp 437


void Snes_Spc::cpu_write(....)
{
  ...
  if ( ((~0x2F00 << (bits_in_int - 16)) << reg) < 0 ) // 36%
  ...
}

FAAC

V610 Undefined behavior. Check the shift operator '<<. The left operand '~0' is negative. libfaac bitstream1.c 796


static int WriteTNSData(....)
{
  ...
  unsignedIndex = (unsigned long) (
    tnsFilterPtr->index[i])&(~(~0<<bitsToTransmit));
  ...
}

Blender

V610 Unspecified behavior. Check the shift operator '>>. The left operand '(- 1)' is negative. bf_editor_space_view3d view3d_draw.c 101


#define cpack(x) glColor3ub( ((x)&0xFF), (((x)>>8)&0xFF), \
(((x)>>16)&0xFF) )

static void star_stuff_init_func(void)
{
  cpack(-1);
  glPointSize(1.0);
  glBegin(GL_POINTS);
}

Identical errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<. The left operand '-1' is negative. bf_intern_ghost ghost_ndofmanager.cpp 289
  • V610 Undefined behavior. Check the shift operator '<<. The left operand '(~0)' is negative. extern_bullet btquantizedbvh.h 82
  • V610 Undefined behavior. Check the shift operator '<<. The left operand '(~0)' is negative. extern_bullet btsoftbodyconcavecollisionalgorithm.h 48

UCSniff

V610 Undefined behavior. Check the shift operator '<<. The left operand '~1' is negative. ec_ip.c 187


#define FP_HOST_NONLOCAL   1<<1

FUNC_DECODER(decode_ip)
{
  ...
  PACKET->PASSIVE.flags &= ~FP_HOST_NONLOCAL;
  ...
}

Identical errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<. The left operand '~1' is negative. ec_ip6.c 110

DeSmuME

V610 Undefined behavior. Check the shift operator '<<. The left operand '~0' is negative. DeSmuME_VS2005 mmu_timing.h 158


enum { TAGMASK = (u32)(~0 << TAGSHIFT) };

Identical errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<. The left operand '~0' is negative. DeSmuME_VS2005 cheatsystem.cpp 1335
  • V610 Undefined behavior. Check the shift operator '<<. The left operand '(- 1)' is negative. DeSmuME_VS2005 gfx3d.cpp 811
  • V610 Unspecified behavior. Check the shift operator '>>. The left operand '(SBits) - 8' is negative. DeSmuME_VS2005 lua-engine.cpp 1345
  • And 2 additional diagnostic messages.

MAME

V610 Undefined behavior. Check the shift operator '<<. The left operand '~0' is negative. atarig42.c 220

V610 Undefined behavior. Check the shift operator '<<. The right operand ('i' = [0..43]) is greater than or equal to the length in bits of the promoted left operand. firetrk.c 113


#define ATARIRLE_PRIORITY_SHIFT  12
#define ATARIRLE_PRIORITY_MASK \
  ((~0 << ATARIRLE_PRIORITY_SHIFT) & 0xffff)

Identical errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<. The left operand '~0' is negative. atarigx2.c 214
  • V610 Undefined behavior. Check the shift operator '<<. The left operand '~0' is negative. atarisy1.c 524
  • V610 Undefined behavior. Check the shift operator '<<. The left operand '~0' is negative. atarisy2.c 354
  • And 46 additional diagnostic messages.

MAME

V610 Undefined behavior. Check the shift operator '<<. The right operand ('i' = [0..43]) is greater than or equal to the length in bits of the promoted left operand. firetrk.c 111


UINT32 m_color1_mask;
UINT32 m_color2_mask;

#define ARRAY_LENGTH(x) (sizeof(x) / sizeof(x[0]))

PALETTE_INIT( montecar )
{
 static const UINT8 colortable_source[] =
 {
  0x00, 0x00, 0x00, 0x01,
  0x00, 0x02, 0x00, 0x03,
  0x03, 0x03, 0x03, 0x02,
  0x03, 0x01, 0x03, 0x00,
  0x00, 0x00, 0x02, 0x00,
  0x02, 0x01, 0x02, 0x02,
  0x00, 0x10, 0x20, 0x30,
  0x00, 0x04, 0x08, 0x0c,
  0x00, 0x44, 0x48, 0x4c,
  0x00, 0x84, 0x88, 0x8c,
  0x00, 0xc4, 0xc8, 0xcc
 };
  ...
 for (i = 0; i < ARRAY_LENGTH(colortable_source); i++)
 {
  UINT8 color = colortable_source[i];

  if (color == 1)
   state->m_color1_mask |= 1 << i;                  <<<---
  else if (color == 2)
   state->m_color2_mask |= 1 << i;                  <<<---

  prom_to_palette(machine, i,
    color_prom[0x100 + colortable_source[i]]);
 }
  ...
}

Clang

V610 Undefined behavior. Check the shift operator '<<. The left operand '~0L' is negative. bitvector.h 175


int find_next(unsigned Prev) const {
  ...
  // Mask off previous bits.
  Copy &= ~0L << BitPos;
  ...
}

Clang

V610 Undefined behavior. Check the shift operator '<<=. The left operand 'Val' is negative. pointerintpair.h 139


static Ty getEmptyKey() {
  intptr_t Val = -1;
  Val <<= PointerLikeTypeTraits<PointerTy>::NumLowBitsAvailable;
  return Ty(reinterpret_cast<PointerTy>(Val),
            IntType((1 << IntBits)-1));
}

Identical errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<. The left operand '~0L' is negative. bitvector.h 454
  • V610 Undefined behavior. Check the shift operator '<<. The left operand '~0L' is negative. sparsebitvector.h 161
  • V610 Undefined behavior. Check the shift operator '<<=. The left operand 'Val' is negative. pointerintpair.h 144
  • And 2 additional diagnostic messages.

Samba

V610 Undefined behavior. Check the shift operator '<<. The left operand '~0' is negative. idtree.c 284


static void *_idr_find(struct idr_context *idp, int id)
{
  ....
  if (n + IDR_BITS < 31 &&
      ((id & ~(~0 << MAX_ID_SHIFT)) >> (n + IDR_BITS))) {
    return NULL;
  }
  ....
}

OpenCV

V610 Unspecified behavior. Check the shift operator '>>. The left operand '(- 2147483647 - 1)' is negative. contours.cpp 1012


CvSeq * cvFindNextContour( CvContourScanner scanner )
{
  ....
  new_mask = INT_MIN >> 1;
  ....
}

ReactOS

V610 Undefined behavior. Check the shift operator '<<. The left operand '-16' is negative. vl_mpeg12_bitstream.c 653


static INLINE int
wrap(short f, int shift)
{
  ....
  if (f < (-16 << shift))
  ....
}

Identical errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<. The left operand '(- 1)' is negative. jdarith.c 460
  • V610 Undefined behavior. Check the shift operator '<<. The left operand '(- 1)' is negative. jdhuff.c 930
  • V610 Undefined behavior. Check the shift operator '<<. The left operand '(- 1)' is negative. layer1.c 86
  • And 6 additional diagnostic messages.

<< Return to list of all diagnostics