[PATCH] D134616: [CodeView] Avoid NULL deref of Scope

Mike Hommey via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 25 14:47:44 PDT 2022


glandium created this revision.
Herald added subscribers: JDevlieghere, hiraditya.
Herald added a project: All.
glandium requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Regression from D131400 <https://reviews.llvm.org/D131400>: cross-language LTO causes a crash in the
compiler on the NULL deref of Scope in `isa` call when Rust IR is
involved. Presumably, this might affect other languages too, and
even Rust itself without cross-language LTO when the Rust compiler
switched to LLVM 16.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134616

Files:
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp


Index: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -3362,7 +3362,7 @@
   // in its name so that we can reference the variable in the command line
   // of the VS debugger.
   std::string QualifiedName =
-      (moduleIsInFortran() || isa<DILocalScope>(Scope))
+      (moduleIsInFortran() || (Scope && isa<DILocalScope>(Scope)))
           ? std::string(DIGV->getName())
           : getFullyQualifiedName(Scope, DIGV->getName());
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134616.462770.patch
Type: text/x-patch
Size: 605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220925/8e81fcfa/attachment.bin>


More information about the llvm-commits mailing list