Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index 34208c73d96d222a668b6cc7a7860ec5fa7d88a0..dd5177d3d6c38a37737e1a15776544143a8e46fa 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -17298,8 +17298,12 @@ RawInteger* Integer::ArithmeticOp(Token::Kind operation, |
break; |
} |
case Token::kSUB: { |
- if (((left_value < 0) == (right_value < 0)) || |
- ((left_value - right_value) < 0) == (left_value < 0)) { |
+ // TODO(srdjan): Investigate why XCode 7 produces wrong code |
+ // if the comparison is inlined as in above (Token::kADD). |
+ const bool both_same_sign = (left_value < 0) == (right_value < 0); |
+ const bool result_same_sign_as_left = |
+ ((left_value - right_value) < 0) == (left_value < 0); |
+ if (both_same_sign || result_same_sign_as_left) { |
return Integer::New(left_value - right_value, space); |
} |
break; |