This is an archive of the discontinued LLVM Phabricator instance.

[opt] Fix static code analysis concerns
ClosedPublic

Authored by asudarsa on Jan 18 2023, 11:10 AM.

Details

Summary

This is an issue reported inside the NewPMDriver module. Static analyzer reported that Null pointer 'P' may be dereferenced at line 371 and two more sites. Proposed change guards this use.

Diff Detail

Event Timeline

asudarsa created this revision.Jan 18 2023, 11:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2023, 11:10 AM
asudarsa requested review of this revision.Jan 18 2023, 11:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2023, 11:10 AM
asudarsa edited the summary of this revision. (Show Details)Jan 18 2023, 11:11 AM
asudarsa retitled this revision from [analyzer] Fix static code analysis concerns to [NewPMDriver] Fix static code analysis concerns.Jan 18 2023, 11:28 AM
asudarsa retitled this revision from [NewPMDriver] Fix static code analysis concerns to [opt] Fix static code analysis concerns.
aeubanks added inline comments.Jan 18 2023, 7:47 PM
llvm/tools/opt/NewPMDriver.cpp
374–376

we should instead return false anywhere we're printing an error message

asudarsa updated this revision to Diff 490508.Jan 19 2023, 7:30 AM

Hi @aeubanks

Thanks a lot for your review. I have updated the review based on your comment. Hope this works.

@asudarsa

asudarsa added inline comments.Jan 19 2023, 7:31 AM
llvm/tools/opt/NewPMDriver.cpp
374–376

Thanks for the review. I have addressed it.

aeubanks added inline comments.Jan 19 2023, 9:39 AM
llvm/tools/opt/NewPMDriver.cpp
374–376

sorry, could you also update the two places above that print an error message?

asudarsa updated this revision to Diff 490573.Jan 19 2023, 10:06 AM
asudarsa edited the summary of this revision. (Show Details)

Based on reviewer's comments, two more code-sites had this issue and have been fixed. Thanks

aeubanks accepted this revision.Jan 19 2023, 10:07 AM

lgtm

do you need me to push this for you?

This revision is now accepted and ready to land.Jan 19 2023, 10:07 AM

lgtm

do you need me to push this for you?

Yes please. That will be great.

Thanks again

llvm/tools/opt/NewPMDriver.cpp
374–376

That's a good catch. Thanks @aeubanks. I have updated them as well. I verified that there are no other sites in this module.

lgtm

do you need me to push this for you?

Yes please. That will be great.

Thanks again

do you have a name/email you'd like to use in the git commit?

lgtm

do you need me to push this for you?

Yes please. That will be great.

Thanks again

do you have a name/email you'd like to use in the git commit?

Ah. This is my first commit in a while. Sorry for missing these steps.
Name: Arvind Sudarsanam
Email address: arvind.sudarsanam@intel.com

This revision was landed with ongoing or failed builds.Jan 19 2023, 11:35 AM
This revision was automatically updated to reflect the committed changes.