ART: Fix a static_cast int32_t -> uint64_t bug.
HConstant::GetValueAsUint64 is used by SsaChecker to verify that
equivalent phis are created only for untyped constants. The test
would fail because a static_cast would sign extend the value of the
IntConstant.
Bug: 24561315
Change-Id: I818ce6a2080994a7c4395d084c1df7fd615a246d
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 84bde8e..d52f592 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -2239,7 +2239,9 @@
public:
int32_t GetValue() const { return value_; }
- uint64_t GetValueAsUint64() const OVERRIDE { return static_cast<uint64_t>(value_); }
+ uint64_t GetValueAsUint64() const OVERRIDE {
+ return static_cast<uint64_t>(static_cast<uint32_t>(value_));
+ }
bool InstructionDataEquals(HInstruction* other) const OVERRIDE {
DCHECK(other->IsIntConstant());