[PATCH] D153942: [NFC]Fix possibly derefer nullptr in ComplexDeinterleavingPass.cpp
Wang, Xin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 28 00:28:54 PDT 2023
XinWang10 created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
XinWang10 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Fix static analyzer reports issue, if RealMuls/ImagMuls/RealAddends/ImagAddends are all empty, FinalNode could not be inited. So move the FinalNode check out to avoid possibly dereference nullptr.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D153942
Files:
llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
Index: llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
===================================================================
--- llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
+++ llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
@@ -1036,17 +1036,15 @@
// accumulator
FinalNode = extractPositiveAddend(RealAddends, ImagAddends);
FinalNode = identifyMultiplications(RealMuls, ImagMuls, FinalNode);
- if (!FinalNode)
- return nullptr;
}
// Identify and process remaining additions
if (!RealAddends.empty() || !ImagAddends.empty()) {
FinalNode = identifyAdditions(RealAddends, ImagAddends, Flags, FinalNode);
- if (!FinalNode)
- return nullptr;
}
+ if (!FinalNode)
+ return nullptr;
// Set the Real and Imag fields of the final node and submit it
FinalNode->Real = Real;
FinalNode->Imag = Imag;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153942.535261.patch
Type: text/x-patch
Size: 852 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230628/e280c1dd/attachment.bin>
More information about the llvm-commits
mailing list