diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index aa04ba60d37..c357b4d0dee 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -241,7 +241,8 @@ bool X86ATTAsmParser::ParseRegister(X86Operand &Op) { getLexer().Lex(); // Eat percent token. const AsmToken &Tok = getLexer().getTok(); - assert(TokPercent.is(AsmToken::Identifier) && "Invalid token kind!"); + if (Tok.isNot(AsmToken::Identifier)) + return Error(Tok.getLoc(), "invalid register name"); // FIXME: Validate register for the current architecture; we have to do // validation later, so maybe there is no need for this here.