summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp4
-rw-r--r--llvm/test/Assembler/invalid-attrgrp.ll4
2 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index b0edeb40d05..a682f97ceb2 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -869,7 +869,9 @@ bool LLParser::ParseUnnamedAttrGrp() {
LocTy AttrGrpLoc = Lex.getLoc();
Lex.Lex();
- assert(Lex.getKind() == lltok::AttrGrpID);
+ if (Lex.getKind() != lltok::AttrGrpID)
+ return TokError("expected attribute group id");
+
unsigned VarID = Lex.getUIntVal();
std::vector<unsigned> unused;
LocTy BuiltinLoc;
diff --git a/llvm/test/Assembler/invalid-attrgrp.ll b/llvm/test/Assembler/invalid-attrgrp.ll
new file mode 100644
index 00000000000..bf1961aa68b
--- /dev/null
+++ b/llvm/test/Assembler/invalid-attrgrp.ll
@@ -0,0 +1,4 @@
+; RUN: not llvm-as < %s 2>&1 | FileCheck %s
+
+attributes
+; CHECK: expected attribute group id
OpenPOWER on IntegriCloud