Skip to content

Fix problems in dpctl identified with Klockwork static code analysis #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 3, 2020

Conversation

vlad-perevezentsev
Copy link
Collaborator

@vlad-perevezentsev vlad-perevezentsev commented Nov 30, 2020

https://jira.devtools.intel.com/browse/SAT-3619

An up - to-date analysis of the klocwork master branch showed 3 warnings. 2 match the previous analysis and have been corrected. Warning memory leak is unchanged because it was created deliberately(Sergey Pokhodenko).

The memory leak warning is still displayed in the klocwork report. I don't know what to do with it. klocwork does not support comments in the code for skipping analysis. You can add a key to build the report table so that the warning is not displayed in the table.

@vlad-perevezentsev vlad-perevezentsev changed the title https://jira.devtools.intel.com/browse/SAT-3619 Fix problems in dpctl identified with Klockwork static code analysis Nov 30, 2020
@@ -148,7 +148,12 @@ size_t DPPLPlatform_GetNumNonHostPlatforms ()

size_t DPPLPlatform_GetNumNonHostBackends ()
{
return get_set_of_non_hostbackends().size();
auto be_set = get_set_of_non_hostbackends();
Copy link
Contributor

@PokhodenkoSA PokhodenkoSA Nov 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the problem?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-void function does not return value

Copy link
Contributor

@PokhodenkoSA PokhodenkoSA Nov 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return get_set_of_non_hostbackends().size(); does not return value? How it is possible?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value should be returned, but at this point klocwork shows a warning

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird that klockwork requires this change, but if it fixes the warning then I am OK with this change.

Copy link
Contributor

@diptorupd diptorupd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there only these two changes? If so, we can merge this and silence the memory leak warning using @vlad-perevezentsev's idea.

@@ -148,7 +148,12 @@ size_t DPPLPlatform_GetNumNonHostPlatforms ()

size_t DPPLPlatform_GetNumNonHostBackends ()
{
return get_set_of_non_hostbackends().size();
auto be_set = get_set_of_non_hostbackends();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird that klockwork requires this change, but if it fixes the warning then I am OK with this change.

@PokhodenkoSA
Copy link
Contributor

@diptorupd we need to get new Klockwork results from CI.

Copy link
Contributor

@PokhodenkoSA PokhodenkoSA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Will see next Klokwork results after merge.

@PokhodenkoSA PokhodenkoSA merged commit 17a1f88 into IntelPython:master Dec 3, 2020
@vlad-perevezentsev vlad-perevezentsev deleted the fix_warnings branch December 15, 2020 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - Ready to merge Review and testing done, is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants