[PATCH] D12538: Fix assertion failure in LLParser::ConvertValIDToValue

Karl Schimpf via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 1 14:54:16 PDT 2015


kschimpf updated this revision to Diff 33738.
kschimpf added a comment.

Add test case.


http://reviews.llvm.org/D12538

Files:
  lib/AsmParser/LLParser.cpp
  lib/AsmParser/LLParser.h
  test/Assembler/invalid-untyped-metadata.ll

Index: test/Assembler/invalid-untyped-metadata.ll
===================================================================
--- /dev/null
+++ 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" ,""  
Index: lib/AsmParser/LLParser.h
===================================================================
--- lib/AsmParser/LLParser.h
+++ lib/AsmParser/LLParser.h
@@ -59,7 +59,7 @@
 
     LLLexer::LocTy Loc;
     unsigned UIntVal;
-    FunctionType *FTy;
+    FunctionType *FTy = nullptr;
     std::string StrVal, StrVal2;
     APSInt APSIntVal;
     APFloat APFloatVal{0.0};
Index: lib/AsmParser/LLParser.cpp
===================================================================
--- lib/AsmParser/LLParser.cpp
+++ lib/AsmParser/LLParser.cpp
@@ -4128,8 +4128,7 @@
     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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12538.33738.patch
Type: text/x-patch
Size: 1398 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150901/2ac207e1/attachment.bin>


More information about the llvm-commits mailing list