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

Instead, create an absolute memory operand.

Fixes PR20504.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214457 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Kleckner 2014-07-31 23:26:35 +00:00
parent 7895ae3135
commit 0b3444cca9
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;
} }
return X86Operand::CreateMem(SegReg, Disp, BaseReg, IndexReg, Scale, if (SegReg || BaseReg || IndexReg)
MemStart, MemEnd); return X86Operand::CreateMem(SegReg, Disp, BaseReg, IndexReg, Scale,
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