From: Karl Schimpf Date: Thu, 3 Sep 2015 16:18:32 +0000 (+0000) Subject: Fix assertion failure in LLParser::ConvertValIDToValue X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e2dfa017cf26b6c99ece1505c6ebf78620622c70;p=oota-llvm.git 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246779 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index df34ba8697f..ac7207f99c4 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/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/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h index e161f95248c..51ba7dec919 100644 --- a/lib/AsmParser/LLParser.h +++ b/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}; diff --git a/test/Assembler/invalid-untyped-metadata.ll b/test/Assembler/invalid-untyped-metadata.ll new file mode 100644 index 00000000000..5a97ae65964 --- /dev/null +++ b/test/Assembler/invalid-untyped-metadata.ll @@ -0,0 +1,6 @@ +; RUN: not llvm-as < %s 2>&1 | FileCheck %s + +; Tests bug: https://llvm.org/bugs/show_bug.cgi?id=24645 +; CHECK: error: invalid type for inline asm constraint string + + !3=! {%..d04 *asm" !6!={!H)4" ,""