Skip to content

Commit

Permalink
Fix a bug in the MC asm parser evaluating expressions. It was treating:
Browse files Browse the repository at this point in the history
A = 9
B = 3 * A - 2 * A + 1 as  B = 3 * A - (2 * A + 1)

rdar://13816516


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181366 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
enderby committed May 7, 2013
1 parent 20d9e41 commit 88535dd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/MC/MCParser/AsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ bool AsmParser::ParseBinOpRHS(unsigned Precedence, const MCExpr *&Res,
MCBinaryExpr::Opcode Dummy;
unsigned NextTokPrec = getBinOpPrecedence(Lexer.getKind(), Dummy);
if (TokPrec < NextTokPrec) {
if (ParseBinOpRHS(Precedence+1, RHS, EndLoc)) return true;
if (ParseBinOpRHS(TokPrec+1, RHS, EndLoc)) return true;
}

// Merge LHS and RHS according to operator.
Expand Down
1 change: 1 addition & 0 deletions test/MC/AsmParser/exprs.s
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ k:
check_expr 0 || 0, 0
check_expr 1 + 2 < 3 + 4, 1
check_expr 1 << 8 - 1, 128
check_expr 3 * 9 - 2 * 9 + 1, 10

.set c, 10
check_expr c + 1, 11
Expand Down

0 comments on commit 88535dd

Please sign in to comment.