mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-21 21:41:43 +00:00
llvm-mc: Fix a crash on invalid due to a typo in relocatable expression
evaluation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78692 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
12ddd40953
commit
b27a41b440
8
test/MC/AsmParser/exprs-invalid.s
Normal file
8
test/MC/AsmParser/exprs-invalid.s
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// RUN: not llvm-mc -triple i386-unknown-unknown %s 2> %t
|
||||||
|
// RUN: FileCheck -input-file %t %s
|
||||||
|
|
||||||
|
.text
|
||||||
|
a:
|
||||||
|
.data
|
||||||
|
// CHECK: expected relocatable expression
|
||||||
|
.long -(0 + a)
|
@ -81,7 +81,7 @@ bool AsmExpr::EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const {
|
|||||||
break;
|
break;
|
||||||
case AsmUnaryExpr::Minus:
|
case AsmUnaryExpr::Minus:
|
||||||
/// -(a - b + const) ==> (b - a - const)
|
/// -(a - b + const) ==> (b - a - const)
|
||||||
if (Value.getSymA() && !Value.getSymA())
|
if (Value.getSymA() && !Value.getSymB())
|
||||||
return false;
|
return false;
|
||||||
Res = MCValue::get(Value.getSymB(), Value.getSymA(),
|
Res = MCValue::get(Value.getSymB(), Value.getSymA(),
|
||||||
-Value.getConstant());
|
-Value.getConstant());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user