From d3b0e745e8a3ead8cc2f0cc246c19c13f0c35ebb Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 7 Oct 2022 08:34:05 +0200 Subject: [CodeView] Avoid NULL deref of Scope Regression from 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. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D134616 --- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp') diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index a97eb9f..a6f1fbc 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -3362,7 +3362,7 @@ void CodeViewDebug::emitDebugInfoForGlobal(const CVGlobalVariable &CVGV) { // in its name so that we can reference the variable in the command line // of the VS debugger. std::string QualifiedName = - (moduleIsInFortran() || isa(Scope)) + (moduleIsInFortran() || (Scope && isa(Scope))) ? std::string(DIGV->getName()) : getFullyQualifiedName(Scope, DIGV->getName()); -- cgit v1.1