From 7fe8a4032a6cf35c19feb024a0e17ec96d88800a 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. llvm-svn: 169074 --- llvm/lib/VMCore/DebugInfo.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/lib/VMCore/DebugInfo.cpp b/llvm/lib/VMCore/DebugInfo.cpp index 5eea2ce..a4fd705 100644 --- a/llvm/lib/VMCore/DebugInfo.cpp +++ b/llvm/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(); } -- 2.7.4