[PATCH] D108092: [AsmPrinter] fix nullptr dereference for MBBs with hasAddressTaken property without BB
Afanasyev Ivan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 15 11:28:31 PDT 2021
ivafanas created this revision.
ivafanas added reviewers: JosephTremoulet, rnk, dblaikie.
Herald added a subscriber: hiraditya.
ivafanas requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Basic block pointer is dereferenced unconditionally for MBBs with hasAddressTaken property.
MBBs might have hasAddressTaken property without reference to BB. Backend developers must assign fake BB to MBB to workaround this issue and it should be fixed.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D108092
Files:
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Index: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -3277,7 +3277,7 @@
// MBBs can have their address taken as part of CodeGen without having
// their corresponding BB's address taken in IR
- if (BB->hasAddressTaken())
+ if (BB && BB->hasAddressTaken())
for (MCSymbol *Sym : MMI->getAddrLabelSymbolToEmit(BB))
OutStreamer->emitLabel(Sym);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108092.366512.patch
Type: text/x-patch
Size: 541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210815/c846fff0/attachment.bin>
More information about the llvm-commits
mailing list