diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index 78b56b744f8..85de47be091 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -1880,8 +1880,10 @@ std::unique_ptr X86AsmParser::ParseMemOperand(unsigned SegReg, return nullptr; } - return X86Operand::CreateMem(SegReg, Disp, BaseReg, IndexReg, Scale, - MemStart, MemEnd); + if (SegReg || BaseReg || IndexReg) + return X86Operand::CreateMem(SegReg, Disp, BaseReg, IndexReg, Scale, + MemStart, MemEnd); + return X86Operand::CreateMem(Disp, MemStart, MemEnd); } bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name, diff --git a/test/MC/X86/x86_operands.s b/test/MC/X86/x86_operands.s index b34713db863..2258a952774 100644 --- a/test/MC/X86/x86_operands.s +++ b/test/MC/X86/x86_operands.s @@ -52,6 +52,11 @@ call *%eax # CHECK: calll *4(%eax) call *4(%eax) +foo: + calll foo() +# CHECK: calll foo{{$}} + calll foo(,) +# CHECK: calll foo{{$}} # CHECK: movl %gs:8, %eax movl %gs:8, %eax