1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

X86 MC: Reject invalid segment registers before a memory operand colon

Previously we would execute unreachable during object emission.

llvm-svn: 214456
This commit is contained in:
Reid Kleckner 2014-07-31 23:03:22 +00:00
parent 751c622bb4
commit 2a45d5a920
2 changed files with 7 additions and 0 deletions

View File

@ -1632,6 +1632,9 @@ std::unique_ptr<X86Operand> X86AsmParser::ParseATTOperand() {
if (getLexer().isNot(AsmToken::Colon)) if (getLexer().isNot(AsmToken::Colon))
return X86Operand::CreateReg(RegNo, Start, End); return X86Operand::CreateReg(RegNo, Start, End);
if (!X86MCRegisterClasses[X86::SEGMENT_REGRegClassID].contains(RegNo))
return ErrorOperand(Start, "invalid segment register");
getParser().Lex(); // Eat the colon. getParser().Lex(); // Eat the colon.
return ParseMemOperand(RegNo, Start); return ParseMemOperand(RegNo, Start);
} }

View File

@ -46,3 +46,7 @@ movl %eax,(,%bx)
// 32: error: invalid operand for instruction // 32: error: invalid operand for instruction
outb al, 4 outb al, 4
// 32: error: invalid segment register
// 64: error: invalid segment register
movl %eax:0x00, %ebx