Examples of errors detected by the V686 diagnostic.


V686. A pattern was detected: A || (A && ...). The expression is excessive or contains a logical error.


Blender

V686 A pattern was detected: (rootsel) || ((rootsel) && ...). The expression is excessive or contains a logical error. ed_transverts.c 325


void ED_transverts_create_from_obedit(....)
{
  ....
  if ((tipsel && rootsel) || (rootsel)) {....}
  ....
}

Similar errors can be found in some other places:

  • V686 A pattern was detected: (!py_b_len) || ((!py_b_len) && ...). The expression is excessive or contains a logical error. aud_pyapi.cpp 864
  • V686 A pattern was detected: (xn == 0.0f) || ((xn == 0.0f) && ...). The expression is excessive or contains a logical error. renderdatabase.c 993
  • V686 A pattern was detected: (xn == 0.0f) || ((xn == 0.0f) && ...). The expression is excessive or contains a logical error. renderdatabase.c 1115

Tor

V686 A pattern was detected: (tm.tm_mday < cfg_start_day) || ((tm.tm_mday < cfg_start_day) && ...). The expression is excessive or contains a logical error. hibernate.c 333


static time_t
edge_of_accounting_period_containing(time_t now, int get_end)
{
  ....
  case UNIT_MONTH: {
    if (tm.tm_mday < cfg_start_day ||
        (tm.tm_mday < cfg_start_day && before)) {
      --tm.tm_mon;
    }
  ....
}

EFL Core Libraries

V686 A pattern was detected: (nextc == '*') || ((nextc == '*') && ...). The expression is excessive or contains a logical error. cpplib.c 1022


static void
copy_rest_of_line(cpp_reader * pfile)
{
  ....
  if (nextc == '*' || (opts->cplusplus_comments && nextc == '*'))
    goto scan_directive_token;
  ....
}

EFL Core Libraries

V686 A pattern was detected: (!im->file) || ((!im->file) && ...). The expression is excessive or contains a logical error. evas_cache2.c 825


static Image_Entry *
_scaled_image_find(Image_Entry *im, ....)
{
   size_t               pathlen, keylen, size;
   char                 *hkey;
   Evas_Image_Load_Opts  lo;
   Image_Entry          *ret;

   if (((!im->file) || ((!im->file) && (!im->key))) ||
       (!im->data1) ||
       ((src_w == dst_w) && (src_h == dst_h)) ||
       ((!im->flags.alpha) && (!smooth))) return NULL;
  ....
}

Similar errors can be found in some other places:

  • V686 A pattern was detected: (!im->file) || ((!im->file) && ...). The expression is excessive or contains a logical error. evas_cache2.c 905

Tizen

V686 A pattern was detected: (sound == 0) || ((sound == 0) && ...). The expression is excessive or contains a logical error. control.c 355


Eina_Bool volume_control_show_view(...., int sound, ....)
{
  ....
  if(((vibration == 1 && sound == 0) || sound == 0) &&
     sound_type == SOUND_TYPE_RINGTONE) {
    volume = 0;
  }
  ....
}


Do you make errors in the code?

Check your code
with PVS-Studio

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

goto PVS-Studio;
On our website we use a cookie to collect information of a technical nature.
If you do not agree, please leave the site. Learn More →
Do not show again