[llvm-commits] [llvm] r78692 - in /llvm/trunk: test/MC/AsmParser/exprs-invalid.s tools/llvm-mc/AsmExpr.cpp
Daniel Dunbar
daniel at zuster.org
Tue Aug 11 10:47:53 PDT 2009
Author: ddunbar
Date: Tue Aug 11 12:47:52 2009
New Revision: 78692
URL: http://llvm.org/viewvc/llvm-project?rev=78692&view=rev
Log:
llvm-mc: Fix a crash on invalid due to a typo in relocatable expression
evaluation.
Added:
llvm/trunk/test/MC/AsmParser/exprs-invalid.s
Modified:
llvm/trunk/tools/llvm-mc/AsmExpr.cpp
Added: llvm/trunk/test/MC/AsmParser/exprs-invalid.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/exprs-invalid.s?rev=78692&view=auto
==============================================================================
--- llvm/trunk/test/MC/AsmParser/exprs-invalid.s (added)
+++ llvm/trunk/test/MC/AsmParser/exprs-invalid.s Tue Aug 11 12:47:52 2009
@@ -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)
Modified: llvm/trunk/tools/llvm-mc/AsmExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.cpp?rev=78692&r1=78691&r2=78692&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmExpr.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmExpr.cpp Tue Aug 11 12:47:52 2009
@@ -81,7 +81,7 @@
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());
More information about the llvm-commits
mailing list