summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Unknown <mbarnett@MIKE-SONY.redmond.corp.microsoft.com>2012-07-31 16:54:15 -0700
committerGravatar Unknown <mbarnett@MIKE-SONY.redmond.corp.microsoft.com>2012-07-31 16:54:15 -0700
commit299fa123930faa5b4031f69cf835fd66dc71a246 (patch)
tree8adb90077c510d73c02d7e8d10c19c98df99c170
parent4afe0b60ef0a72161a1d37d0ddf266d52e36d186 (diff)
Fix a bug when static fields are used in as operands for ++ or --.
-rw-r--r--BCT/BytecodeTranslator/ExpressionTraverser.cs28
1 files changed, 15 insertions, 13 deletions
diff --git a/BCT/BytecodeTranslator/ExpressionTraverser.cs b/BCT/BytecodeTranslator/ExpressionTraverser.cs
index 64f4777f..19af68d9 100644
--- a/BCT/BytecodeTranslator/ExpressionTraverser.cs
+++ b/BCT/BytecodeTranslator/ExpressionTraverser.cs
@@ -1217,22 +1217,24 @@ namespace BytecodeTranslator
} else {
Bpl.Expr x = null;
Bpl.IdentifierExpr temp = null;
- if (target.Instance != null) {
- this.Traverse(target.Instance);
- x = this.TranslatedExpressions.Pop();
- if (pushTargetRValue) {
+ if (pushTargetRValue) {
+ if (target.Instance != null) {
+ this.Traverse(target.Instance);
+ x = this.TranslatedExpressions.Pop();
AssertOrAssumeNonNull(tok, x);
var e2 = this.sink.Heap.ReadHeap(x, f, TranslationHelper.IsStruct(field.ContainingType) ? AccessType.Struct : AccessType.Heap, boogieTypeOfField);
this.TranslatedExpressions.Push(e2);
-
- if (!treatAsStatement && resultIsInitialTargetRValue) {
- var loc = this.sink.CreateFreshLocal(source.Type);
- temp = Bpl.Expr.Ident(loc);
- var e3 = this.TranslatedExpressions.Pop();
- var cmd = Bpl.Cmd.SimpleAssign(tok, temp, e3);
- this.StmtTraverser.StmtBuilder.Add(cmd);
- this.TranslatedExpressions.Push(temp);
- }
+ } else {
+ TranslatedExpressions.Push(f);
+ }
+
+ if (!treatAsStatement && resultIsInitialTargetRValue) {
+ var loc = this.sink.CreateFreshLocal(source.Type);
+ temp = Bpl.Expr.Ident(loc);
+ var e3 = this.TranslatedExpressions.Pop();
+ var cmd = Bpl.Cmd.SimpleAssign(tok, temp, e3);
+ this.StmtTraverser.StmtBuilder.Add(cmd);
+ this.TranslatedExpressions.Push(temp);
}
}
sourceTraverser(source);