diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index b0edeb40d05..a682f97ceb2 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/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 unused; LocTy BuiltinLoc; diff --git a/test/Assembler/invalid-attrgrp.ll b/test/Assembler/invalid-attrgrp.ll new file mode 100644 index 00000000000..bf1961aa68b --- /dev/null +++ b/test/Assembler/invalid-attrgrp.ll @@ -0,0 +1,4 @@ +; RUN: not llvm-as < %s 2>&1 | FileCheck %s + +attributes +; CHECK: expected attribute group id