To get a trial key
fill out the form below
Team License (standard version)
Enterprise License (extended version)
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
GBP
RUB
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Message submitted.

Your message has been sent. We will email you at


If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

>
>
Examples of errors detected by the V712…

Examples of errors detected by the V712 diagnostic

April 5, 2021

V712. Be advised that compiler may delete this cycle or make it infinity. 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

Popular related articles
The Ultimate Question of Programming, Refactoring, and Everything

Date: 04.14.2016

Author: Andrey Karpov

Yes, you've guessed correctly - the answer is "42". In this article you will find 42 recommendations about coding in C++ that can help a programmer avoid a lot of errors, save time and effort. The au…
Free PVS-Studio for those who develops open source projects

Date: 12.22.2018

Author: Andrey Karpov

On the New 2019 year's eve, a PVS-Studio team decided to make a nice gift for all contributors of open-source projects hosted on GitHub, GitLab or Bitbucket. They are given free usage of PVS-Studio s…
The Last Line Effect

Date: 05.31.2014

Author: Andrey Karpov

I have studied many errors caused by the use of the Copy-Paste method, and can assure you that programmers most often tend to make mistakes in the last fragment of a homogeneous code block. I have ne…
The way static analyzers fight against false positives, and why they do it

Date: 03.20.2017

Author: Andrey Karpov

In my previous article I wrote that I don't like the approach of evaluating the efficiency of static analyzers with the help of synthetic tests. In that article, I give the example of a code fragment…
Static analysis as part of the development process in Unreal Engine

Date: 06.27.2017

Author: Andrey Karpov

Unreal Engine continues to develop as new code is added and previously written code is changed. What is the inevitable consequence of ongoing development in a project? The emergence of new bugs in th…
PVS-Studio ROI

Date: 01.30.2019

Author: Andrey Karpov

Occasionally, we're asked a question, what monetary value the company will receive from using PVS-Studio. We decided to draw up a response in the form of an article and provide tables, which will sho…
Appreciate Static Code Analysis!

Date: 10.16.2017

Author: Andrey Karpov

I am really astonished by the capabilities of static code analysis even though I am one of the developers of PVS-Studio analyzer myself. The tool surprised me the other day as it turned out to be sma…
Technologies used in the PVS-Studio code analyzer for finding bugs and potential vulnerabilities

Date: 11.21.2018

Author: Andrey Karpov

A brief description of technologies used in the PVS-Studio tool, which let us effectively detect a large number of error patterns and potential vulnerabilities. The article describes the implementati…
PVS-Studio for Java

Date: 01.17.2019

Author: Andrey Karpov

In the seventh version of the PVS-Studio static analyzer, we added support of the Java language. It's time for a brief story of how we've started making support of the Java language, how far we've co…
How PVS-Studio Proved to Be More Attentive Than Three and a Half Programmers

Date: 10.22.2018

Author: Andrey Karpov

Just like other static analyzers, PVS-Studio often produces false positives. What you are about to read is a short story where I'll tell you how PVS-Studio proved, just one more time, to be more atte…

Comments (0)

Next comments

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site.
Learn More →
Accept