X86 MC: Don't crash on empty memory operand parens

Instead, create an absolute memory operand.

Fixes PR20504.

llvm-svn: 214457
This commit is contained in:
Reid Kleckner 2014-07-31 23:26:35 +00:00
parent 0c5da97dd0
commit b7e2f6015a
2 changed files with 9 additions and 2 deletions

View File

@ -1880,8 +1880,10 @@ std::unique_ptr<X86Operand> X86AsmParser::ParseMemOperand(unsigned SegReg,
return nullptr; return nullptr;
} }
if (SegReg || BaseReg || IndexReg)
return X86Operand::CreateMem(SegReg, Disp, BaseReg, IndexReg, Scale, return X86Operand::CreateMem(SegReg, Disp, BaseReg, IndexReg, Scale,
MemStart, MemEnd); MemStart, MemEnd);
return X86Operand::CreateMem(Disp, MemStart, MemEnd);
} }
bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name, bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,

View File

@ -52,6 +52,11 @@
call *%eax call *%eax
# CHECK: calll *4(%eax) # CHECK: calll *4(%eax)
call *4(%eax) call *4(%eax)
foo:
calll foo()
# CHECK: calll foo{{$}}
calll foo(,)
# CHECK: calll foo{{$}}
# CHECK: movl %gs:8, %eax # CHECK: movl %gs:8, %eax
movl %gs:8, %eax movl %gs:8, %eax