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

Examples of errors detected by the V634 diagnostic

V634. Priority of '+' operation is higher than priority of '<<' operation. Consider using parentheses in the expression.


Haiku Operation System

V634 The priority of the '*' operation is higher than that of the '<<' operation. It's possible that parentheses should be used in the expression. RAW.cpp 1141


void
DCRaw::_WaveletDenoise()
{
  ....
  for (i = 0; i < (1 << dim * 2); i++) {  // <=
    if (fimg[i] < -fThreshold)
      fimg[i] += fThreshold;
    else if (fimg[i] > fThreshold)
      fimg[i] -= fThreshold;
    else
      fimg[i] = 0;
  }
  ....
}

Similar errors can be found in some other places:

  • V634 The priority of the '*' operation is higher than that of the '<<' operation. It's possible that parentheses should be used in the expression. RAW.cpp 1099

CryEngine V

V634 The priority of the '*' operation is higher than that of the '<<' operation. It's possible that parentheses should be used in the expression. model.cpp 336


enum joint_flags
{
  angle0_locked = 1,
  ....
};

bool CDefaultSkeleton::SetupPhysicalProxies(....)
{
  ....
  for (int j = 0; .... ; j++)
  {
    // lock axes with 0 limits range
    m_arrModelJoints[i]....flags |= (....) * angle0_locked << j;
  }
  ....
}

System Shock

V634 The priority of the '-' operation is higher than that of the '<<' operation. It's possible that parentheses should be used in the expression. FRCLIP.C 256


#define span_right(y,s) \
  (x_span_lists[((y)<<SPAN_SHIFT)+(s<<1)+SPAN_RIGHT])

void fr_span_parse(void)
  {
  ....
  if (....span_right(y,(*cur_span_cnt)-1)....)>frpipe_dist)
    ....
  ....
}

Stellarium

V634 The priority of the '*' operation is higher than that of the '<<' operation. It's possible that parentheses should be used in the expression. StelHips.cpp 271


HipsTile* HipsSurvey::getTile(int order, int pix)
{
  ....
  if (order == orderMin && !allsky.isNull())
  {
    int nbw = sqrt(12 * 1 << (2 * order));
    ....
  }
  ....
}

What the programmer must have really meant is this: int nbw = sqrt(12 * (1 << 2 * order));


Qemu

V634 The priority of the '*' operation is higher than that of the '<<' operation. It's possible that parentheses should be used in the expression. nand.c 310


static void nand_command(NANDFlashState *s)
{
  ....
  s->addr &= (1ull << s->addrlen * 8) - 1;
  ....
}

Snort

V634 The priority of the '*' operation is higher than that of the '<<' operation. It's possible that parentheses should be used in the expression. bug34427.c 160


int process_val(const u_int8_t *data, u_int32_t data_len,
  u_int32_t *retvalue, ....) {
  *retvalue = 0;
  ....
/* Now find the actual value */
  for (; i < data_len; i++) {
    *retvalue += data[i] * PM_EXP2(8 * (data_len - i - 1));
  }

  return(0);
}

#define PM_EXP2(A) 1 << A

DPDK

V634 The priority of the '/' operation is higher than that of the '<<' operation. It's possible that parentheses should be used in the expression. test_common.c 221


#define MAX_NUM 1 << 20

static int
test_align(void)
{
  ....
  for (p = 1; p <= MAX_NUM / 2; p++) {             // <=
    for (i = 1; i <= MAX_NUM / 2; i++) {           // <=
      val = RTE_ALIGN_MUL_CEIL(i, p);
      if (val % p != 0 || val < i)
        FAIL_ALIGN("RTE_ALIGN_MUL_CEIL", i, p);
      val = RTE_ALIGN_MUL_FLOOR(i, p);
      if (val % p != 0 || val > i)
        FAIL_ALIGN("RTE_ALIGN_MUL_FLOOR", i, p);
      val = RTE_ALIGN_MUL_NEAR(i, p);
      if (val % p != 0 || ((val != RTE_ALIGN_MUL_CEIL(i, p))
        & (val != RTE_ALIGN_MUL_FLOOR(i, p))))
        FAIL_ALIGN("RTE_ALIGN_MUL_NEAR", i, p);
    }
  }
  ....
}

Similar errors can be found in some other places:

  • V634 The priority of the '/' operation is higher than that of the '<<' operation. It's possible that parentheses should be used in the expression. test_common.c 222