Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam

Webinar: Evaluation - 05.12

>
>
>
Examples of errors detected by the V711…

Examples of errors detected by the V711 diagnostic

V711. It is dangerous to create a local variable within a loop with a same name as a variable controlling this loop.


Haiku Operation System

V711 It is dangerous to create a local variable within a loop with a same name as a variable controlling this loop. ipv4.cpp 514


static int
dump_ipv4_multicast(int argc, char** argv)
{
  MulticastState::Iterator it = sMulticastState->GetIterator();

  while (it.HasNext()) {
    ....
    int count = 0;
    IPv4GroupInterface::AddressSet::Iterator it
      = state->Sources().GetIterator();
    while (it.HasNext()) {
      ....
    }

    kprintf("}> sock %p\n", state->Parent()->Socket());
  }

  return 0;
}

Telegram

V711 It is dangerous to create a local variable within a loop with a same name as a variable controlling this loop. Telegram dialogswidget.cpp 949


void DialogsListWidget::addDialog(const MTPDdialog &dialog)
{
  History *history = App::history(App::peerFromMTP(
                                 dialog.vpeer),
                                 dialog.vunread_count.v,
                                 dialog.vread_inbox_max_id.v);
  ....
  SavedPeersByTime &saved(cRefSavedPeersByTime());
  while (!saved.isEmpty() &&
           history->lastMsg->date < saved.lastKey())
  {
    History *history = App::history(saved.last()->id);
    ....
  }
  ....
}

Wine Is Not an Emulator

V711 It is dangerous to create a local variable within a loop with a same name as a variable controlling this loop. dplobby.c 765


static HRESULT WINAPI
IDirectPlayLobby3AImpl_EnumAddressTypes(....)
{
  ....
  FILETIME filetime;
  ....
  /* Traverse all the service providers we have available */
  for( dwIndex=0; RegEnumKeyExA( hkResult, dwIndex, subKeyName,
       &sizeOfSubKeyName,
       NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS;
       ++dwIndex, sizeOfSubKeyName=50 )
  {
    ....
    FILETIME filetime;
    ....
    /* Traverse all the address type we have available */
      for( dwAtIndex=0; RegEnumKeyExA( hkServiceProviderAt,
           dwAtIndex, atSubKey, &sizeOfSubKeyName,
           NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS;
        ++dwAtIndex, sizeOfSubKeyName=50 )
      {
        ....
      }
    ....
  }
  ....
}

FreeBSD Kernel

V711 It is dangerous to create a local variable within a loop with a same name as a variable controlling this loop. powernow.c 733


static int
pn_decode_pst(device_t dev)
{
  ....
  struct pst_header *pst;                                   // <=
  ....
  p = ((uint8_t *) psb) + sizeof(struct psb_header);
  pst = (struct pst_header*) p;

  maxpst = 200;

  do {
    struct pst_header *pst = (struct pst_header*) p;        // <=

    ....

    p += sizeof(struct pst_header) + (2 * pst->numpstates);
  } while (cpuid_is_k7(pst->cpuid) && maxpst--);            // <=
  ....
}