From 44876c535f55650a25417b3dc589bd9372bd4fec Mon Sep 17 00:00:00 2001 From: Karl Schimpf Date: Thu, 3 Sep 2015 16:18:32 +0000 Subject: Fix assertion failure in LLParser::ConvertValIDToValue Summary: Fixes bug 24645. Problem appears to be that the type may be undefined when ConvertValIDToValue is called. Reviewers: kcc Subscribers: llvm-commits llvm-svn: 246779 --- llvm/lib/AsmParser/LLParser.cpp | 3 +-- llvm/lib/AsmParser/LLParser.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'llvm/lib/AsmParser') diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index df34ba8697f..ac7207f99c4 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -4128,8 +4128,7 @@ bool LLParser::ConvertValIDToValue(Type *Ty, ValID &ID, Value *&V, V = PFS->GetVal(ID.StrVal, Ty, ID.Loc, OC); return V == nullptr; case ValID::t_InlineAsm: { - assert(ID.FTy); - if (!InlineAsm::Verify(ID.FTy, ID.StrVal2)) + if (!ID.FTy || !InlineAsm::Verify(ID.FTy, ID.StrVal2)) return Error(ID.Loc, "invalid type for inline asm constraint string"); V = InlineAsm::get(ID.FTy, ID.StrVal, ID.StrVal2, ID.UIntVal & 1, (ID.UIntVal >> 1) & 1, diff --git a/llvm/lib/AsmParser/LLParser.h b/llvm/lib/AsmParser/LLParser.h index e161f95248c..51ba7dec919 100644 --- a/llvm/lib/AsmParser/LLParser.h +++ b/llvm/lib/AsmParser/LLParser.h @@ -59,7 +59,7 @@ namespace llvm { LLLexer::LocTy Loc; unsigned UIntVal; - FunctionType *FTy; + FunctionType *FTy = nullptr; std::string StrVal, StrVal2; APSInt APSIntVal; APFloat APFloatVal{0.0}; -- cgit v1.2.3