From 2587a8a18c55116b339d4b47d441512067e9c96b Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Sat, 1 Dec 2012 02:23:45 +0000 Subject: [PATCH] VMCore/DebugInfo.cpp: DICompileUnit::getSubprograms(): Check numOperands(). 2012-11-30-misched-dbg.ll had crashed. Then (MDNode)N was "!{}". I am not sure it would be ill-formed or not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169074 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/DebugInfo.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/VMCore/DebugInfo.cpp b/lib/VMCore/DebugInfo.cpp index 5eea2ce9e0a..a4fd705e30c 100644 --- a/lib/VMCore/DebugInfo.cpp +++ b/lib/VMCore/DebugInfo.cpp @@ -659,8 +659,9 @@ DIArray DICompileUnit::getSubprograms() const { return DIArray(); if (MDNode *N = dyn_cast_or_null(DbgNode->getOperand(12))) - if (MDNode *A = dyn_cast_or_null(N->getOperand(0))) - return DIArray(A); + if (N->getNumOperands() > 0) + if (MDNode *A = dyn_cast_or_null(N->getOperand(0))) + return DIArray(A); return DIArray(); }