[llvm] r246779 - Fix assertion failure in LLParser::ConvertValIDToValue
Karl Schimpf via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 3 09:18:32 PDT 2015
Author: kschimpf
Date: Thu Sep 3 11:18:32 2015
New Revision: 246779
URL: http://llvm.org/viewvc/llvm-project?rev=246779&view=rev
Log:
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
Added:
llvm/trunk/test/Assembler/invalid-untyped-metadata.ll
Modified:
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/AsmParser/LLParser.h
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=246779&r1=246778&r2=246779&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Thu Sep 3 11:18:32 2015
@@ -4128,8 +4128,7 @@ bool LLParser::ConvertValIDToValue(Type
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,
Modified: llvm/trunk/lib/AsmParser/LLParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=246779&r1=246778&r2=246779&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.h (original)
+++ llvm/trunk/lib/AsmParser/LLParser.h Thu Sep 3 11:18:32 2015
@@ -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};
Added: llvm/trunk/test/Assembler/invalid-untyped-metadata.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/invalid-untyped-metadata.ll?rev=246779&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/invalid-untyped-metadata.ll (added)
+++ llvm/trunk/test/Assembler/invalid-untyped-metadata.ll Thu Sep 3 11:18:32 2015
@@ -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" ,""
More information about the llvm-commits
mailing list