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

[X86][MC] Fix bracket expression parsing in intel-style assembly.

Only perform struct field check on Identifier tokens.

Fixes PR28547.

Reviewers: rnk

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D22361

llvm-svn: 275445
This commit is contained in:
Nirav Dave 2016-07-14 17:37:05 +00:00
parent af512cd747
commit 29b7bfa64f
2 changed files with 10 additions and 2 deletions

View File

@ -1394,7 +1394,7 @@ X86AsmParser::ParseIntelBracExpression(unsigned SegReg, SMLoc Start,
return ErrorOperand(BracLoc, "Expected '[' token!");
Parser.Lex(); // Eat '['
SMLoc StartInBrac = Tok.getLoc();
SMLoc StartInBrac = Parser.getTok().getLoc();
// Parse [ Symbol + ImmDisp ] and [ BaseReg + Scale*IndexReg + ImmDisp ]. We
// may have already parsed an immediate displacement before the bracketed
// expression.
@ -1423,7 +1423,10 @@ X86AsmParser::ParseIntelBracExpression(unsigned SegReg, SMLoc Start,
// Parse struct field access. Intel requires a dot, but MSVC doesn't. MSVC
// will in fact do global lookup the field name inside all global typedefs,
// but we don't emulate that.
if (Tok.getString().find('.') != StringRef::npos) {
if ((Parser.getTok().getKind() == AsmToken::Identifier ||
Parser.getTok().getKind() == AsmToken::Dot ||
Parser.getTok().getKind() == AsmToken::Real) &&
Parser.getTok().getString().find('.') != StringRef::npos) {
const MCExpr *NewDisp;
if (ParseIntelDotOperator(Disp, NewDisp))
return nullptr;

5
test/MC/X86/pr28547.s Normal file
View File

@ -0,0 +1,5 @@
// RUN: llvm-mc -triple x86_64-unknown-unknown %s
.intel_syntax
ones:
.float +1.0, +1.0, +1.0, +1.0
vmovaps xmm15, xmmword ptr [rip+ones] # +1.0, +1.0, +1.0, +1.0