mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-04 01:42:09 +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;
|
||||
case AsmUnaryExpr::Minus:
|
||||
/// -(a - b + const) ==> (b - a - const)
|
||||
if (Value.getSymA() && !Value.getSymA())
|
||||
if (Value.getSymA() && !Value.getSymB())
|
||||
return false;
|
||||
Res = MCValue::get(Value.getSymB(), Value.getSymA(),
|
||||
-Value.getConstant());
|
||||
|
Loading…
Reference in New Issue
Block a user