Examples of errors detected by the V570 diagnostic

V570. The variable is assigned to itself.


Qt

V570 The 'transition->m_hasGetterSetterProperties' variable is assigned to itself. QtScript structure.cpp 512


PassRefPtr<Structure> Structure::
  getterSetterTransition(Structure* structure)
{
  ...
  RefPtr<Structure> transition =
    create(structure->storedPrototype(), structure->typeInfo());
  transition->m_propertyStorageCapacity =
    structure->m_propertyStorageCapacity;
  transition->m_hasGetterSetterProperties =      // <=
    transition->m_hasGetterSetterProperties;
  transition->m_hasNonEnumerableProperties =
    structure->m_hasNonEnumerableProperties;
  transition->m_specificFunctionThrashCount =
    structure->m_specificFunctionThrashCount;
  ...
}

A critical initialization error: transition->m_hasGetterSetterProperties = transition->m_hasGetterSetterProperties.


ReactOS

V570 The 'mii->cch' variable is assigned to itself. user32 menu.c 4347


BOOL WINAPI GetMenuItemInfoA(....)
{
  ...
  mii->cch = mii->cch;
  ...
}

Looks like a misprint. The code should look like this: mii->cch = miiW->cch;


Quake-III-Arena

V570 The 'p->org[0]' variable is assigned to itself. cgame cg_marks.c 1267


void CG_ParticleSnowFlurry (qhandle_t pshader, centity_t *cent)
{
  ...
  p->org[0] = p->org[0];
  p->org[1] = p->org[1];
  p->org[2] = p->org[2];
  ...
}

OpenCV

V570 The 'stereo.fundMatr[i]' variable is assigned to itself. calibfilter.cpp 339


typedef struct CvStereoCamera
{
 ....
 float fundMatr[9]; /* fundamental matrix */
 ....
};

CvStereoCamera stereo;

void CvCalibFilter::Stop( bool calibrate )
{
  ....
  for( i = 0; i < 9; i++ )
  {
    stereo.fundMatr[i] = stereo.fundMatr[i];
  }
  ....
}

OpenCV

V570 The 'xyD[r]' variable is assigned to itself. test_imgwarp_strict.cpp 560


void CV_Resize_Test::resize_1d(....)
{
  ....
  for (int r = 0; r < cn; ++r)
  {
    xyD[r] = 0;
    for (int k = 0; k < ksize; ++k)
      xyD[r] += w[k] * xyS[k * cn + r];
    xyD[r] = xyD[r];
  }
  ....
}

OpenCV

V570 The 'sizes[INPUT][0].height' variable is assigned to itself. test_math.cpp 1356


void Core_DetTest::get_test_array_types_and_sizes(....)
{
  ....
  sizes[INPUT][0].width =
    sizes[INPUT][0].height = sizes[INPUT][0].height;
  ....
}

ReactOS

V570 The 'pUserColorControl->dwFlags' variable is assigned to itself. gdientry.c 1029


DWORD WINAPI
DdGetDriverInfo(LPDDHAL_GETDRIVERINFODATA pData)
{
  ....
  pUserColorControl->dwFlags = pUserColorControl->dwFlags;
  ....
}

Identical errors can be found in some other places:

  • V570 The 'Irp->IoStatus.Information' variable is assigned to itself. hidclass.c 461

VirtualDub

V570 The 'this->hic' variable is assigned to itself. Riza w32videocodecpack.cpp 253


void VDVideoCompressorVCM::Start(const void *inputFormat,
                                 uint32 inputFormatSize,
                                 const void *outputFormat,
                                 uint32 outputFormatSize,
                                 const VDFraction& frameRate,
                                 VDPosition frameCount)
{
  this->hic    = hic;
  ....
}

Coin3D

V570 The 'v0[0]' variable is assigned to itself. sotext3.cpp 1158


void
SoText3P::generate(....)
{
  ....
  v0[0] = v0[0];
  ....
}

Identical errors can be found in some other places:

  • V570 The 'v0[1]' variable is assigned to itself. sotext3.cpp 1159
  • V570 The 'v1[0]' variable is assigned to itself. sotext3.cpp 1160
  • V570 The 'v1[1]' variable is assigned to itself. sotext3.cpp 1161
  • And 4 additional diagnostic messages.

CryEngine 3 SDK

V570 The 'modifiedSlopeNormal.z' variable is assigned to itself. playerstateground.cpp 227


void CPlayerStateGround::OnPrePhysicsUpdate(....)
{
  ....
  modifiedSlopeNormal.z = modifiedSlopeNormal.z;
  ....
}

Unreal Engine 4

V570 The 'ResolveParams.CubeFace' variable is assigned to itself. rhi.h 1279


enum ECubeFace;
ECubeFace CubeFace;

friend FArchive& operator<<(
  FArchive& Ar,FResolveParams& ResolveParams)
{
  ....
  if(Ar.IsLoading())
  {
    ResolveParams.CubeFace = (ECubeFace)ResolveParams.CubeFace;
  }
  ....
}

TortoiseGit

V570 The 'blame->path' variable is assigned to itself. blame.c 319


static int blame_internal(git_blame *blame)
{
  ....
  blame->ent = ent;
  blame->path = blame->path;
  ....
}

Chromium

V570 The 'tmp_rect.right' variable is assigned to itself. text_store.cc 320


STDMETHODIMP TextStore::GetTextExt(....) {
  ....
  tmp_rect.right = tmp_rect.right;
  ....
}

OpenJPEG

V570 The 'p_stream->m_current_data' variable is assigned to itself. cio.c 675


OPJ_SIZE_T opj_stream_write_skip (
  opj_stream_private_t * p_stream, ....)
{
  ....
  if (!l_is_written)
  {
    p_stream->m_status |= opj_stream_e_error;
    p_stream->m_bytes_in_buffer = 0;
    p_stream->m_current_data = p_stream->m_current_data;
    return (OPJ_SIZE_T) -1;
  }
  ....
}

Linux Kernel

V570 The 'acx->window_size' variable is assigned to itself. acx.c 1728


int wl12xx_acx_config_hangover(struct wl1271 *wl)
{
  ....
  acx->recover_time = cpu_to_le32(conf->recover_time);
  acx->hangover_period = conf->hangover_period;
  acx->dynamic_mode = conf->dynamic_mode;
  acx->early_termination_mode = conf->early_termination_mode;
  acx->max_period = conf->max_period;
  acx->min_period = conf->min_period;
  acx->increase_delta = conf->increase_delta;
  acx->decrease_delta = conf->decrease_delta;
  acx->quiet_time = conf->quiet_time;
  acx->increase_time = conf->increase_time;
  acx->window_size = acx->window_size;         // <=
  ....
}

FreeCAD

V570 The 'this->quat[3]' variable is assigned to itself. rotation.cpp 260


Rotation & Rotation::invert(void)
{
  this->quat[0] = -this->quat[0];
  this->quat[1] = -this->quat[1];
  this->quat[2] = -this->quat[2];
  this->quat[3] =  this->quat[3]; // <=
  return *this;
}

GNU Octave

V570 The 'i' variable is assigned to itself. sparse.cc 144


template <class T>
void Sparse<T>::SparseRep::maybe_compress(bool remove_zeros)
{
  ....
  octave_idx_type i = 0;
  for (octave_idx_type j = 1; j <= ncols; j++)
  {
    octave_idx_type u = c[j];
    for (i = i; i < u; i++)            // <=
      if (d[i] != T())
      {
        d[k] = d[i];
        r[k++] = r[i];
      }
    c[j] = k;
  }
 ....
}

Identical errors can be found in some other places:

  • V570 The 'i' variable is assigned to itself. sparse.cc 967

FreeSWITCH

V570 The variable is assigned to itself. skypopen_protocol.c 1512


struct SkypopenHandles {
  HWND win32_hInit_MainWindowHandle;
  HWND win32_hGlobal_SkypeAPIWindowHandle;
  ....
};

LRESULT APIENTRY skypopen_present(...., WPARAM uiParam, ....)
{
 ....
 if (!tech_pvt->SkypopenHandles.currentuserhandle) {
   tech_pvt->SkypopenHandles.api_connected = 1;
   tech_pvt->SkypopenHandles.win32_hGlobal_SkypeAPIWindowHandle =
    (HWND) uiParam;
   tech_pvt->SkypopenHandles.win32_hGlobal_SkypeAPIWindowHandle =
    tech_pvt->SkypopenHandles.win32_hGlobal_SkypeAPIWindowHandle;
 }
 ....
}

Unreal Engine 4

V570 The 'Position' variable is assigned to itself. drawelements.h 435


class FSlateDrawElement
{
  ....
  FORCEINLINE void SetPosition(const FVector2D& InPosition)
  { Position = Position; }
  ....
  FVector2D Position;
  ....
};

ChakraCore

V570 The 'this->isInlined' variable is assigned to itself. functioncodegenjittimedata.h 625


void SetupRecursiveInlineeChain(
    Recycler *const recycler,
    const ProfileId profiledCallSiteId)
{
  if (!inlinees)
  {
    inlinees = RecyclerNewArrayZ(....);
  }
  inlinees[profiledCallSiteId] = this;
  inlineeCount++;
  this->isInlined = isInlined;   // <=
}

Identical errors can be found in some other places:

  • V570 The 'sym->m_isTaggableIntConst' variable is assigned to itself. linearscan.cpp 3170

FreeBSD Kernel

V570 The 'lenRecv' variable is assigned to itself. itdinit.c 271


osGLOBAL void
itdssGetOperatingOptionParams(....)
{
  ....
  /* to remove compiler warnings */
  pLastUsedChar   = pLastUsedChar;
  lenRecv         = lenRecv;
  subkey2         = subkey2;
  subkey1         = subkey1;
  key             = key;
  buffer          = &tmpBuffer[0];
  buffLen         = sizeof (tmpBuffer);
  ....
}

Oracle VM Virtual Box

V570 The 'from->eval1D[i].u1' variable is assigned to itself. state_evaluators.c 1006


void
crStateEvaluatorDiff(CREvaluatorBits *e, CRbitvalue *bitID,
                     CRContext *fromCtx, CRContext *toCtx)
{
  ....
  from->eval1D[i].order = to->eval1D[i].order;
  from->eval1D[i].u1 = from->eval1D[i].u1;     // <=
  from->eval1D[i].u2 = from->eval1D[i].u2;     // <=
  ...
}

Identical errors can be found in some other places:

  • V570 The 'from->eval1D[i].u2' variable is assigned to itself. state_evaluators.c 1007
  • V570 The 'from->eval2D[i].u1' variable is assigned to itself. state_evaluators.c 1042
  • V570 The 'from->eval2D[i].u2' variable is assigned to itself. state_evaluators.c 1043
  • And 2 additional diagnostic messages.

The GTK+ Project

V570 The 'tmp_info' variable is assigned to itself. gtkimcontextxim.c 442


static GtkXIMInfo *
get_im (....)
{
  ....
  GtkXIMInfo *info;
  ....
  info = NULL;
  tmp_list = open_ims;
  while (tmp_list)
    {
      ....
      else
        {
          tmp_info = tmp_info;           // <=
          break;
        }
      ....
    }
  if (info == NULL)
    {
      ....
    }
  ....
}

ReactOS

V570 The 'idButton' variable is assigned to itself. mainwindow.cpp 546


LRESULT CDeviceManager::OnNotify(_In_ LPARAM lParam)
{
  ....
  UINT_PTR idButton = lpttt->hdr.idFrom;
  switch (idButton)
  {
    ....
  }
  idButton = idButton; // <=
  ....
}

Open X-Ray Engine

V570 The 'value[0]' variable is assigned to itself. compiler_cover.cpp 260


void compute_cover_value (....)
{
  ....
  float    value    [8];
  ....
  if (value[0] < .999f) {
    value[0] = value[0];
  }
  ....
}

CryEngine V

V570 The 'runtimeData.entityId' variable is assigned to itself. behaviortreenodes_ai.cpp 1771


void ExecuteEnterScript(RuntimeData& runtimeData)
{
  ExecuteScript(m_enterScriptFunction, runtimeData.entityId);

  runtimeData.entityId = runtimeData.entityId; // <=
  runtimeData.executeExitScriptIfDestructed = true;
}


Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++ and C#

goto PVS-Studio;