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

Examples of errors detected by the V591 diagnostic

April 5, 2021

V591. Non-void function should return a value.


Quake-III-Arena

V591 Non-void function should return a value. botlib q_shared.h 155


static ID_INLINE int BigLong(int l)
{ LongSwap(l); }

Need: { return LongSwap(l); }

Similar errors can be found in some other places:

  • V591 Non-void function should return a value. botlib q_shared.h 157

Haiku Operation System

V591 Non-void function should return a value. pc.c 1031


ULONG
set_var(char *name, ULONG val)
{
  variable *v;

  v = lookup_var(name);
  if (v != NULL)
    v->value = val;
  else
    add_var(name, val);
}

SETI@home

V591 Non-void function should return a value. x86_float4.h 237


struct float4
{
  ....
  inline float4 rsqrt() const {
  }
  inline float4 sqrt() const {
  }
  inline float4 recip() const {
  }
  ....
};

Similar errors can be found in some other places:

  • V591 Non-void function should return a value. x86_float4.h 239
  • V591 Non-void function should return a value. x86_float4.h 241

Unreal Engine 4

V591 Non-void function should return a value. slistview.h 53


class FColumnHeaderSlot
{
public:
  FColumnHeaderSlot& operator[](
    const TSharedRef< SHeaderRow >& InColumnHeaders )
  {
    HeaderRow = InColumnHeaders;
  }
  ....
}

Missing return *this.


Open X-Ray Engine

V591 Non-void function should return a value. _matrix33.h 435


template <class T>
struct _matrix33
{
public:
  typedef _matrix33<T>Self;
  typedef Self& SelfRef;
  ....
  IC SelfRef sMTxV(Tvector& R, float s1, const Tvector& V1) const
  {
    R.x = s1*(m[0][0] * V1.x + m[1][0] * V1.y + m[2][0] * V1.z);
    R.y = s1*(m[0][1] * V1.x + m[1][1] * V1.y + m[2][1] * V1.z);
    R.z = s1*(m[0][2] * V1.x + m[1][2] * V1.y + m[2][2] * V1.z);
  }
  ....
}

Chromium

V591 Non-void function should return a value. memory_allocator.h 39


CheckReturnValue& operator=(const CheckReturnValue& other) {
  if (this != &other) {
    DCHECK(checked_);
    value_ = other.value_;
    checked_ = other.checked_;
    other.checked_ = true;
  }
}

Missing return *this.


LLVM/Clang

V591 Non-void function should return a value. RPCUtils.h 719


SequenceNumberManager &operator=(SequenceNumberManager &&Other) {
  NextSequenceNumber = std::move(Other.NextSequenceNumber);
  FreeSequenceNumbers = std::move(Other.FreeSequenceNumbers);
}

Aspell

V591 Non-void function should return a value. lsort.hpp 159


template <class N>
static inline N * fix_links(N * cur)
{
  N * prev = 0;
  while (cur) {
    cur->prev = prev;
    prev = cur;
    cur = cur->next;
  }
}

EFL Core Libraries

V591 Non-void function should return a value. ecore_evas_extn.c 1526


static Eina_Bool
_ipc_server_data(void *data, int type EINA_UNUSED, void *event)
{
  ....
  //TIZEN_ONLY(170317): add skipping indicator buffer logic
  if (indicator_buffer_skip)
    return;
  //END
  ....
  //TIZEN_ONLY(170317): add skipping indicator buffer logic
  if (_ecore_evas_indicator_size_check(ee, &(extn->b[n].w)))
    {
       indicator_buffer_skip = EINA_TRUE;
       return;                                  // <=
    }
  else
    indicator_buffer_skip = EINA_FALSE;
  //END
  ....
}

Similar errors can be found in some other places:

  • V591 Non-void function should return a value. ecore_evas_extn.c 1617

EFL Core Libraries

V591 Non-void function should return a value. eina_accessor.hh 330


_self_type& operator=(_self_type const& other)
{
  _base_type::operator=(other);
}

Android

V591 CWE-393 Non-void function should return a value. linux_close.cpp 139


int NET_RecvFrom(int s, void *buf, int len, unsigned int flags,
       struct sockaddr *from, int *fromlen) {
  socklen_t socklen = *fromlen;
  BLOCKING_IO_RETURN_INT(
    s, recvfrom(s, buf, len, flags, from, &socklen) );
  *fromlen = socklen;
}

Similar errors can be found in some other places:

  • V591 CWE-393 Non-void function should return a value. linux_close.cpp 158

NCBI Genome Workbench

V591 Non-void function should return a value. bio_tree.hpp 266


/// Recursive assignment
CBioNode& operator=(const CBioNode& tree)
{
  TParent::operator=(tree);
  TBioTree* pt = (TBioTree*)tree.GetParentTree();
  SetParentTree(pt);
}

Haiku Operation System

V591 Non-void function should return a value. Referenceable.h 228


BReference& operator=(const BReference<const Type>& other)
{
  fReference = other.fReference;
}

Similar errors can be found in some other places:

  • V591 Non-void function should return a value. Referenceable.h 233
  • V591 Non-void function should return a value. Referenceable.h 239

Haiku Operation System

V591 Non-void function should return a value. main.c 1010


void errx(int, const char *, ...) ;

char *
getoptionvalue(const char *name)
{
  struct option *c;

  if (name == NULL)
    errx(1, "getoptionvalue() invoked with NULL name");
  c = getoption(name);
  if (c != NULL)
    return (c->value);
  errx(1, "getoptionvalue() invoked with unknown option `%s'", name);
  /* NOTREACHED */
}

'errx' doesn't contain noreturn attribute.


ROOT

V591 Non-void function should return a value. LogLikelihoodFCN.h 108


LogLikelihoodFCN & operator = (const LogLikelihoodFCN & rhs) {
  SetData(rhs.DataPtr() );
  SetModelFunction(rhs.ModelFunctionPtr() );
  fNEffPoints = rhs.fNEffPoints;
  fGrad = rhs.fGrad;
  fIsExtended = rhs.fIsExtended;
  fWeight = rhs.fWeight;
  fExecutionPolicy = rhs.fExecutionPolicy;
}

Command & Conquer

V591 Non-void function should return a value. HEAP.H 123


int FixedHeapClass::Free(void * pointer);

template<class T>
class TFixedHeapClass : public FixedHeapClass
{
  ....
  virtual int Free(T * pointer) {FixedHeapClass::Free(pointer);};
};

Strf

V591 Non-void function should return a value. numpunct.hpp 402


template <int Base>
class numpunct: private strf::digits_grouping
{
  ....
  constexpr STRF_HD numpunct& operator=(const numpunct& other) noexcept
  {
    strf::digits_grouping::operator=(other);
    decimal_point_ = other.decimal_point_;
    thousands_sep_ = other.thousands_sep_;
  }
  ....
};

Strf

V591 Non-void function should return a value. numpunct.hpp 528


template <int Base>
class no_grouping final
{
  constexpr STRF_HD no_grouping& operator=(const no_grouping& other) noexcept
  {
    decimal_point_ = other.decimal_point_;
  }
  ....
}

Chobo Single-Header Libraries

V591 Non-void function should return a value. vector_view.hpp 163


template <typename T, typename U, typename Alloc = std::allocator<T>>
class vector_view
{
  ....
  vector_view& operator=(vector_view&& other)
  {
    m_vector = std::move(other.m_vector);
  }
  ....
}

Chobo Single-Header Libraries

V591 Non-void function should return a value. vector_view.hpp 184


template <typename UAlloc>
vector_view& operator=(const std::vector<U, UAlloc>& other)
{
  size_type n = other.size();
  resize(n);
  for (size_type i = 0; i < n; ++i)
  {
    this->at(i) = other[i];
  }
}

PpluX

V591 Non-void function should return a value. px_render.h 398


struct DisplayList {
  DisplayList& operator=(DisplayList &&d) {
    data_ = d.data_;
    d.data_ = nullptr;
  }
  ....
}

Universal

V591 Non-void function should return a value. matrix.hpp 109


template<typename Scalar>
class matrix {
  ....
  matrix& diagonal() {
  }
  ....
};

manif

V591 Non-void function should return a value. lie_group_base.h 347


template <typename _Derived>
typename LieGroupBase<_Derived>::Scalar*
LieGroupBase<_Derived>::data()
{
  return derived().coeffs().data();     // OK
}

template <typename _Derived>
const typename LieGroupBase<_Derived>::Scalar*
LieGroupBase<_Derived>::data() const
{
  derived().coeffs().data();            // ERROR
}

Popular related articles
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…
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…
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…
The Evil within the Comparison Functions

Date: 05.19.2017

Author: Andrey Karpov

Perhaps, readers remember my article titled "Last line effect". It describes a pattern I've once noticed: in most cases programmers make an error in the last line of similar text blocks. Now I want t…
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…
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…
Characteristics of PVS-Studio Analyzer by the Example of EFL Core Libraries, 10-15% of False Positives

Date: 07.31.2017

Author: Andrey Karpov

After I wrote quite a big article about the analysis of the Tizen OS code, I received a large number of questions concerning the percentage of false positives and the density of errors (how many erro…
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…
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…
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…

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