Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Possible division by zero - fails to detect

QcoreUser
QcoreUser Posts: 1

Hello.
I am running a static analysis checks with Parasoft C/C++ test. And I encountered the following issue: passing a zero parameter to a function which afterwards uses it to divide is not always detected/reported. For example:

void some_function()
{
test_function(0);
}

void test_function(int parameter)
{
int var = 5 / parameter;
}

Usually it is detected, But if I add some number of function before calling test_function(0), the issue will not be reported. Like this:

void some_function()
{
other_function_1();
other_function_2();
...
other_function_n();
test_function(0);
}

Anyone encountered or knows why this works this way?