Getting acquainted with PVS-Studio source code analyzer

Abstract

In the article, a brief description of PVS-Studio source code analyzer is given.

Introduction

PVS-Studio is a static code analyzer by OOO "Program Verification Systems" designed for developers of modern resource-intensive applications. PVS-Studio combines the possibilities of 64-bit code analysis from Viva64 unit, parallel code analysis from VivaMP unit and general purpose analysis. It lets you develop, test, perform migration and verification and of course create applications in C/C++/C++11 at a high level of reliability.

OOO "Program Verification Systems" Company is engaged in development and sales of code analyzers. Our products are: Viva64, code analyzer for migration and development of 64-bit applications, and VivaMP, code analyzer for verification of parallel OpenMP programs. These analyzers proved to be in demand by one group of users. That is why we have created a new software product, PVS-Studio, which comprises the two tools and provides an integrated solution for development of modern resource-intensive applications in C/C++/C++11 languages. A new general purpose analysis rules set had also been added to PVS-Studio analyzer.

Features

PVS-Studio installation is quite simple. At your machine, Microsoft Visual Studio 2005/2008/2010 IDE should be installed. For 64-bit applications analysis, it is advisable to have a 64-bit compiler which is a part of Visual Studio.

After installation, PVS-Studio is integrated in Visual Studio menu as shown in figure.

Figure 1: PVS-Studio integration into Microsoft Visual Studio

Figure 1: PVS-Studio integration into Microsoft Visual Studio

There are 3 sets of rules included into PVS-Studio:

  • Diagnostics of 64-bit errors (Viva64)
  • Diagnostics of parallel errors (VivaMP)
  • Diagnostics of general-purpose issues

PVS-Studio lets you detect the following bug types in the source code of programs in C/C++/C++11 languages:

  • Errors of 32-bit applications migration to 64-bit systems;
  • Errors occurring during new 64-bit application development;
  • Non-optimal use of memory in 64-bit programs due to alignment peculiarities;
  • Errors in parallel programs connected with lack of knowledge of OpenMP technology syntax;
  • Errors in parallel programs connected with lack of knowledge of code paralleling laws using OpenMP;
  • Errors occurring due to incorrect work with memory in parallel code (unguarded access to common memory, lack of synchronization, incorrect mode of access to variables, etc.).

All these groups of bugs occur both in new applications and in old ones either during attempts of porting them to a 64-bit platform or during code paralleling.

Using PVS-Studio analyzer, you can enhance the quality of a software product, reduce time of development and testing of the solution, and to provide code security.

Bugs search is conducted by static analysis technology, this lets you diagnose problems without running the application and the analysis is independent from your development environment. This is particularly important for errors diagnostics in parallel programs.

All the diagnosed errors are described in detail in the online help system that can be opened from PVS-Studio by clicking on the error message. PVS-Studio help system is also available online at our site.

In the distribution kit, special project examples of code bugs are supplied together with PVS-Studio, the analyzer work can be studied on these examples.

Conclusions

PVS-Studio code analyzer is necessary if you:

  • Develop new 64-bit applications;
  • Carry out 32-bit code migration to 64-bit systems;
  • Add support of parallel execution to your program with the help of OpenMP technology.