Examples of errors detected by the V779 diagnostic.


V779. Unreachable code detected. It is possible that an error is present.


Far2l

V779 Unreachable code detected. It is possible that an error is present. 7z.cpp 203


BOOL WINAPI _export SEVENZ_OpenArchive(const char *Name,
                                       int *Type)
{
  Traverser *t = new Traverser(Name);
  if (!t->Valid())
  {
    return FALSE;
    delete t;          // <=
  }

  delete s_selected_traverser;
  s_selected_traverser = t;
  return TRUE;
}

FreeBSD Kernel

V779 Unreachable code detected. It is possible that an error is present. if_wi_pci.c 258


static int
wi_pci_resume(device_t dev)
{
  struct wi_softc  *sc = device_get_softc(dev);
  struct ieee80211com *ic = &sc->sc_ic;

  WI_LOCK(sc);
  if (sc->wi_bus_type != WI_BUS_PCI_NATIVE) {
    return (0);                                 // <=
    WI_UNLOCK(sc);                              // <=
  }
  if (ic->ic_nrunning > 0)
    wi_init(sc);
  WI_UNLOCK(sc);
  return (0);
}

Valgrind

V779 Unreachable code detected. It is possible that an error is present. host_arm_isel.c 461


static
Bool doHelperCallWithArgsOnStack ( UInt*   stackAdjustAfterCall,
                                   RetLoc* retloc,
                                   ISelEnv* env,
                                   IRExpr* guard,
                                   IRCallee* cee, IRType retTy,
                                   IRExpr** args )
{
  ....
   if (guard) {
      if (guard->tag == Iex_Const
          && guard->Iex.Const.con->tag == Ico_U1
          && guard->Iex.Const.con->Ico.U1 == True) {
         /* unconditional -- do nothing */
      } else {
         goto no_match; //ATC                   // <=
         cc = iselCondCode( env, guard );       // <=
      }
   }
  ....
}

EFL Core Libraries

V779 Unreachable code detected. It is possible that an error is present. timeout.c 30


extern void _exit (int __status) __attribute__ ((__noreturn__));

static void
_timeout(int val)
{
  _exit(-1);
  if (val) return;
}

EFL Core Libraries

V779 Unreachable code detected. It is possible that an error is present. edje_cc_out.c 1102


void
error_and_abort(Eet_File *ef EINA_UNUSED, const char *fmt, ...)
{
   va_list ap;

   va_start(ap, fmt);
   eina_log_vprint(_edje_cc_log_dom, EINA_LOG_LEVEL_CRITICAL,
                   "unknown", "unknown", 0, fmt, ap);
   va_end(ap);
   unlink(file_out);
   if (watchfile) unlink(watchfile);
   exit(-1);
}

static void
data_thread_image_end(....)
{
  ....
  if (iw->errstr)
  {
    error_and_abort(iw->ef, iw->errstr);                   // <=
    free(iw->errstr);                                      // <=
  }
  ...
}

Similar errors can be found in some other places:

  • V779 Unreachable code detected. It is possible that an error is present. evas_gl_core.c 483
  • V779 Unreachable code detected. It is possible that an error is present. edje_cc_out.c 737
  • V779 Unreachable code detected. It is possible that an error is present. edje_cc_out.c 835
  • And 12 additional diagnostic messages.

Tizen

V779 Unreachable code detected. It is possible that an error is present. bt-hdp.c 295


static int __bt_hdp_internal_add_filter(void)
{
  BT_DBG("+");

  if (g_hdp_dus_conn) {
    BT_ERR("g_hdp_dus_conn already exist");
    return BLUETOOTH_ERROR_NONE;
  }

  g_hdp_dus_conn = _bt_gdbus_get_system_gconn();
  retv_if(g_hdp_dus_conn == NULL, BLUETOOTH_ERROR_INTERNAL);

  return __bt_hdp_add_filter_subscribe_signal(g_hdp_dus_conn,
                                              TRUE);

  BT_DBG("-\n");                                           // <=
}

Tizen

V779 Unreachable code detected. It is possible that an error is present. Integrity.cpp 233


void Integrity::createHardLink(....) {
  int ret = link(oldName.c_str(), newName.c_str());

  if (ret < 0) {
    int err = errno;
    throw UnexpectedErrorException(err, strerror(err));
    LOGN("Trying to link to non-existent...", oldName.c_str());
  }
}

Tizen

V779 Unreachable code detected. It is possible that an error is present. myplace-suggest.c 68


#define LS_FUNC_ENTER LS_LOGD("(%s) ENTER", __FUNCTION__);
#define LS_FUNC_EXIT  LS_LOGD("(%s) EXIT", __FUNCTION__);

static bool __check_myplace_automation(void)
{
  LS_FUNC_ENTER
  bool myplace_automation_supported = false;
  bool myplace_automation_consent = false;
  ....
  return false;
  LS_FUNC_EXIT
}

Tizen

V779 Unreachable code detected. It is possible that an error is present. setting-common-view.c 124


#define SETTING_TRACE_END  do {\
    SECURE_LOGD("\033[0;35mEXIT FUNCTION: %s. \033[0m\n", \
      __FUNCTION__);\
} while (0)

EXPORT_PUBLIC
setting_view *setting_view_get_topview(setting_view *view)
{
  SETTING_TRACE_BEGIN;
  retv_if(NULL == view, NULL);
  int idx = 0;
  SettingViewNode *viewnode = NULL;
  ....

  if (viewnode && viewnode->topview)
    return viewnode->topview;
  else
    return NULL;

  SETTING_TRACE_END;                                       // <=
}

Tizen

V779 Unreachable code detected. It is possible that an error is present. ad-id.c 472


#define AI_FUNC_EXIT  AI_LOGD("(%s) EXIT", __FUNCTION__);

int main(int argc, char *argv[])
{
  AI_FUNC_ENTER

  int ret = APP_ERROR_NONE;
  ad_id_app_data_s ad = {0,};

  ....

  if (ret != APP_ERROR_NONE)
    AI_LOGE("ui_app_main() is failed. err=%d", ret);

  return 0;                                                // <=
  AI_FUNC_EXIT                                             // <=
}

Similar errors can be found in some other places:

  • V779 Unreachable code detected. It is possible that an error is present. myplace.c 197
  • V779 Unreachable code detected. It is possible that an error is present. layout_network.c 1666

MuseScore

V779 Unreachable code detected. It is possible that an error is present. figuredbass.cpp 1377


bool FiguredBass::setProperty(P_ID propertyId, const QVariant& v)
{
  score()->addRefresh(canvasBoundingRect());
  switch(propertyId) {
    default:
      return Text::setProperty(propertyId, v);
    }
  score()->setLayoutAll();
  return true;
}

Similar errors can be found in some other places:

  • V779 Unreachable code detected. It is possible that an error is present. fingering.cpp 165
  • V779 Unreachable code detected. It is possible that an error is present. chordrest.cpp 1127

Audacity

V779 Unreachable code detected. It is possible that an error is present. ToolBar.cpp 706


void ToolBar::MakeRecoloredImage( teBmps eBmpOut, teBmps eBmpIn )
{
  // Don't recolour the buttons...
  MakeMacRecoloredImage( eBmpOut, eBmpIn );
  return;
  wxImage * pSrc = &theTheme.Image( eBmpIn );
  ....
}

Tizen

V779 Unreachable code detected. It is possible that an error is present. main-view.c 261


#define startfunc   LOGD("+-  START -------------------------");
#define endfunc     LOGD("+-  END  --------------------------");

static Eina_Bool
_main_view_send_result_after_transform(void *data)
{
  startfunc
  main_view *view = (main_view *)data;
  if (view->transformtype == CAM_TRANSFORM_CROP) {
    DBG("crop completed, Start resize");
    _main_view_ug_send_result(view, view->filename);
    _main_view_start_camera_preview(view->camera);
    view->transformtype = CAM_TRANSFORM_NONE;
  }
  return ECORE_CALLBACK_CANCEL;     // <=
  endfunc                           // <=
}

ICU

V779 CWE-561 Unreachable code detected. It is possible that an error is present. collationdatabuilder.cpp 392


uint32_t CollationDataBuilder::setPrimaryRangeAndReturnNext(....)
{
  ....
  } else {
    // Short range: Set individual CE32s.
    for(;;) {
      utrie2_set32(....);
      ++start;
      primary = Collation::incThreeBytePrimaryByOffset(....);
      if(start > end) { return primary; }
    }
    modified = TRUE;       // <=
  }
}

The loop may be interrupted only by calling the operator'return'. This means that assignment, located in the code after the loop will never be executed.



Do you make errors in the code?

Check your code
with PVS-Studio

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

goto PVS-Studio;
We use cookies for the analysis of events to improve our content and make user interaction more convenient. By continuing the view of our web-pages you accept the terms of using these files. You can find out more about cookie-files and privacy policy or close the notification, by clicking on the button. Learn More →
Do not show