[PATCH] D142047: [analyzer] Fix static code analysis concerns

Arvind Sudarsanam via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 18 11:10:40 PST 2023


asudarsa created this revision.
Herald added subscribers: manas, steakhal, ASDenysPetrov, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun.
Herald added a project: All.
asudarsa requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142047

Files:
  llvm/tools/opt/NewPMDriver.cpp


Index: llvm/tools/opt/NewPMDriver.cpp
===================================================================
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -368,7 +368,8 @@
     } else /* CSPGOKindFlag == CSInstrUse */ {
       if (!P)
         errs() << "CSInstrUse needs to be together with InstrUse";
-      P->CSAction = PGOOptions::CSIRUse;
+      else
+        P->CSAction = PGOOptions::CSIRUse;
     }
   }
   if (TM)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142047.490251.patch
Type: text/x-patch
Size: 448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230118/641d6f00/attachment.bin>


More information about the llvm-commits mailing list