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 V712…

Examples of errors detected by the V712 diagnostic

V712. Compiler may optimize out this loop or make it infinite. Use volatile variable(s) or synchronization primitives to avoid this.


G3D Content Pak

V712 Be advised that compiler may delete this cycle or make it endless. Use volatile variable(s) or synchronization primitives to avoid this. table.h 622


bool containsKey(const Key& key) const {
  unsigned int code = ::hashCode(key);
  unsigned int b = code % numBuckets;

  Node* node = bucket[b];

  while (node != NULL) {
    if ((node->hashCode == code) &&
        (node->entry.key == key)) {
      return true;
    }
    node = node->next;
  } while (node != NULL);

  return false;
}

The diagnostic have indirectly detected an error of another kind. Actually, the loop is empty. The closing parenthesis corresponds to another 'while' operator.


IPP Samples

V712 Be advised that compiler may delete this cycle or make it endless. Use volatile variable(s) or synchronization primitives to avoid this. vm_file_win.c 857


Ipp32s vm_file_fscanf(vm_file *fd, vm_char *format, ...) {
  BOOL     eol = FALSE;
  ....
  if ( (ws != NULL) &&
       ((bpt = fpt =
           (vm_char *)malloc(STRBYTES(format)+16)) != NULL)) {
    vm_string_strcpy(fpt,format);
    va_start( args, format );
    ....
    va_end( args );
    eol = TRUE;
    free(bpt);
  } while (!eol);
  ....
}

The diagnostic have indirectly detected an error of another kind. Actually, the loop is empty. The closing parenthesis corresponds to 'if' operator.


GINV

V712 Be advised that compiler may delete this cycle or make it infinity. Use volatile variable(s) or synchronization primitives to avoid this. idivision.cpp 371


int IDivision::nfAbsRem(ICoeff &multiplier, IPoly &poly) const {
  ....
  IWrap* wrap = NULL;
  IPoly::Iterator &i(*poly.begin());
  while (i) {
    wrap = find(i.monom());
    if (wrap) {
      if (coeffInterface()->type() == ICoeffInterface::GmpZZ) {
        quot->quotAbsRem(i.coeff(), wrap->poly().lc(), *rem);
        if (!quot->isZero()) break;
      }
      wrap = NULL;
    }
    ++i;
  }
  while(wrap == NULL);   // <=
  ....
}

The diagnostic have indirectly detected an error of another kind. Actually, the loop is empty. The closing parenthesis corresponds to previous while operator.


eMule Plus

V712 Be advised that compiler may delete this cycle or make it infinity. Use volatile variable(s) or synchronization primitives to avoid this. securedvars.h 26


class CRWLockLite
{
  ....
  LONG m_nReaders;
public:
  ....
  void WriteLock() { m_csLock.Enter();
                     while (m_nReaders) Sleep(0); }
};

FreeSWITCH

V712 Be advised that compiler may delete this cycle or make it infinity. Use volatile variable(s) or synchronization primitives to avoid this. play_win32.c 356


char *busy;
DWORD dwFlags;

int32
ad_stop_play(ad_play_t * p)
{
  ....
  while (p->busy[i] && (!(whdr->dwFlags & WHDR_DONE)))
    Sleep(100);
  ....
}

FreeSWITCH

V712 Be advised that compiler may delete this cycle or make it infinity. Use volatile variable(s) or synchronization primitives to avoid this. speed.c 330


static unsigned int lapse, schlock;

static double Time_F(int s)
{
  ....
  while (!schlock) Sleep(0);  /* scheduler spinlock  */
  }
  ....
}

Shareaza

V712 Be advised that compiler may delete this cycle or make it infinity. Use volatile variable(s) or synchronization primitives to avoid this. sqlite3.c 17794


static int winMutex_isInit = 0;

static int winMutexInit(void){
  ....
  while( !winMutex_isInit ){
    Sleep(1);
  }
  ....
}

FCEUX

V712 Be advised that compiler may delete this cycle or make it infinity. Use volatile variable(s) or synchronization primitives to avoid this. outputds.cpp 162


class ThreadData {
public:
  ThreadData() { kill = dead = false; }
  OAKRA_Module_OutputDS *ds;
  bool kill,dead;
};

OAKRA_Module_OutputDS::~OAKRA_Module_OutputDS() {
  //ask the driver to shutdown, and wait for it to do so
  ((ThreadData *)threadData)->kill = true;
  while(!((ThreadData *)threadData)->dead) Sleep(1);
  ....
}

MPC-HC

V712 Be advised that compiler may delete this cycle or make it infinity. Use volatile variable(s) or synchronization primitives to avoid this. shoutcastsource.cpp 507


bool fExitThread;

HRESULT CShoutcastStream::OnThreadCreate()
{
  EmptyBuffer();

  fExitThread = true;
  m_hSocketThread =
    AfxBeginThread(::SocketThreadProc, this)->m_hThread;
  while (fExitThread) {
    Sleep(10);
  }

  return NOERROR;
}

Similar errors can be found in some other places:

  • V712 Be advised that compiler may delete this cycle or make it infinity. Use volatile variable(s) or synchronization primitives to avoid this. mainfrm.cpp 11792

ReactOS

V712 Be advised that compiler may delete this cycle or make it infinity. Use volatile variable(s) or synchronization primitives to avoid this. ff_ioman.c 539


FF_T_SINT32 FF_BlockRead(....) {
  FF_T_SINT32 slRetVal = 0;
  ....
  if(pIoman->pBlkDevice->fnpReadBlocks)
  {
    ....
    slRetVal = pIoman->pBlkDevice->fnpReadBlocks(pBuffer,
    ulSectorLBA, ulNumSectors, pIoman->pBlkDevice->pParam);
    ....
     if(FF_GETERROR(slRetVal) == FF_ERR_DRIVER_BUSY) {
           FF_Sleep(FF_DRIVER_BUSY_SLEEP);
     }
  } while(FF_GETERROR(slRetVal) == FF_ERR_DRIVER_BUSY); // <=

  return slRetVal;
}

Open X-Ray Engine

V712 Be advised that compiler may delete this cycle or make it infinity. Use volatile variable(s) or synchronization primitives to avoid this. xrcdb.cpp 100


class XRCDB_API MODEL
{
  ....
  u32 status; // 0=ready, 1=init, 2=building
  ....
}

void MODEL::build (Fvector* V, int Vcnt, TRI* T, int Tcnt,
                   build_callback* bc, void* bcp)
{
  ....
  BTHREAD_params P = { this, V, Vcnt, T, Tcnt, bc, bcp };
  thread_spawn(build_thread,"CDB-construction",0,&P);
  while (S_INIT == status) Sleep(5);
  ....
}

Similar errors can be found in some other places:

  • V712 Be advised that compiler may delete this cycle or make it infinity. Use volatile variable(s) or synchronization primitives to avoid this. levelcompilerloggerwindow.cpp 23
  • V712 Be advised that compiler may delete this cycle or make it infinity. Use volatile variable(s) or synchronization primitives to avoid this. levelcompilerloggerwindow.cpp 232

qdEngine

V712 [CWE-835, CERT-MSC06-C] Be advised that compiler may delete this cycle or make it infinity. Use volatile variable(s) or synchronization primitives to avoid this. PlayOgg.cpp 293


static int b_thread_must_stop=0;

void MpegDeinitLibrary()
{
  ....
  if(hThread!=INVALID_HANDLE_VALUE)
  {
    b_thread_must_stop=1;
    while(b_thread_must_stop==1)
      Sleep(10);
  }
  ....
}

DPDK

V712 Be advised that compiler may delete this cycle or make it infinity. Use volatile variable(s) or synchronization primitives to avoid this. main.c 353


struct __rte_cache_aligned vhost_crypto_info {
  ....
  uint32_t nb_inflight_ops;
  ....
};

static void
destroy_device(int vid)
{
  struct vhost_crypto_info *info = NULL;
  ....
  info = options.infos[i];
  ....
  do {

  } while (info->nb_inflight_ops);

  info->initialized[j] = 0;
  ....
}