|
|
|||
![]() PVS-Studio Static Code Analyzer for 64-bit and parallel C/C++ code
|
|||
![]() ![]() ![]() ![]() ![]()
28.06.2010
Why is the number of the line where an issue was found sometimes absent in the Error List in PVS-Studio? Sometimes the PVS-Studio code analyzer seems to find an issue in the code on which it generates a message, specifies the file name but does not show the number of the line with the issue as shown in the figure.»
07.06.2010
Communication between developers and users Abstract When developing software products, developers need very much to get feedback from users of their programs.» ![]()
22.07.2010
Using PVS-Studio with continuous integration systems This article illustrates techniques required to employ the use of PVS-Studio static code analyzer together with continuous integration systems.»
06.07.2010
Comparing capabilities of PVS-Studio and Visual Studio 2010 in detecting defects in 64-bit programs In the article, we will compare three mechanisms of code analysis from the viewpoint of detecting 64-bit errors: the Visual C++ 2010 compiler, the Code Analysis for C/C++ component included into Visual Studio 2010 and Viva64 analyzer included into PVS-Studio 3.60.»
29.06.2010
A Collection of Examples of 64-bit Errors in Real Programs
This article is the most complete collection of examples of 64-bit errors in the C and C++ languages.» ![]()
22.07.2010
We released a new version of PVS-Studio code analyzer - PVS-Studio 3.61»
10.06.2010
We released a new version of PVS-Studio code analyzer - PVS-Studio 3.60. »
19.05.2010
Our workers visited the GDC2010 conference that was held on May, 14-16, 2010, in Moscow and talked to many developers who participated there.»
|
Documentation![]() V1303. The 'foo' function which throws an exception cannot be used in a parallel section outside of a try..catch blockThe analyzer found an error relating to throwing an exception from a parallel block. According to OpenMP specification, if you use exceptions inside a parallel block all these exceptions should be processed inside this block. The analyzer warns about the call of a function which is marked as throwing exceptions in a parallel block and which is not protected by try..catch block. When an exception is thrown from ExceptionFoo function the example given below leads to incorrect program's behavior and most likely to a program crash: void ExceptionFoo() throw(...) { }
void foo1303(ptrdiff_t n)
{
#pragma omp parallel for
for (ptrdiff_t i = 0; i < n; ++i)
{
//...
ExceptionFoo();
//...
}
}
Correction of the code lies in processing exceptions inside the parallel block and transferring information about the error through other mechanisms. Below the two variants of the corrected function are given: void foo1303_fixed(ptrdiff_t n)
{
#pragma omp parallel for
for (ptrdiff_t i = 0; i != n; ++i)
{
try {
//...
ExceptionFoo();
//...
}
catch (...) {
// process exception
}
}
}
You should keep in mind that functions not marked as throw(...) can also generate exceptions. But VivaMP analyzer doesn't consider calling them unsafe. It is made to generate diagnostic messages in a reasonable number. Otherwise any code containing function call will be considered unsafe. The following principle is used: void foo(); - suppose it don't throw an exception void foo() throw();- doesn't throw an exception void foo() throw(...); - throws an exception |
||
|
© 2008 - 2010, OOO "Program Verification Systems"
300027, Russia, Tula, P.O. Box 1800. Office: Russia, Tula, Kutuzova 100-73 |
|||