summaryrefslogtreecommitdiffstats
path: root/runtime/atomic.h
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-06-06 21:27:01 -0700
committerAndreas Gampe <agampe@google.com>2014-06-06 21:27:01 -0700
commita55c697a8276b1c82b108a695bbd588725aa015e (patch)
treeb636e82692421bc57b163a86ab8c103b03ada40a /runtime/atomic.h
parentcef85adb4933bbd00ca122aa7357e02c716df326 (diff)
downloadart-a55c697a8276b1c82b108a695bbd588725aa015e.tar.gz
art-a55c697a8276b1c82b108a695bbd588725aa015e.tar.bz2
art-a55c697a8276b1c82b108a695bbd588725aa015e.zip
ART: Fix casts in atomic.h to please GCC
GCC 4.9 for ARM64 is not happy about reinterpret_cast-ing between int64_t and uint64_t, which is according to spec. Change the concrete casts to static_cast. However, we also use this for pointers, and we cannot static_cast those to int64_t. So add a reinterpret_cast to uintptr_t. Change-Id: If6513fbcbb8ee8f610f172310af61cf2e9ab0c43
Diffstat (limited to 'runtime/atomic.h')
-rw-r--r--runtime/atomic.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/runtime/atomic.h b/runtime/atomic.h
index 04daea85b1..ed83a33b0b 100644
--- a/runtime/atomic.h
+++ b/runtime/atomic.h
@@ -392,7 +392,7 @@ template<class T> struct AtomicHelper<8, T> {
// sizeof(T) == 8
volatile const int64_t* loc_ptr =
reinterpret_cast<volatile const int64_t*>(loc);
- return reinterpret_cast<T>(QuasiAtomic::Read64(loc_ptr));
+ return static_cast<T>(QuasiAtomic::Read64(loc_ptr));
}
static void StoreRelaxed(volatile T* loc, T desired) {
@@ -400,7 +400,7 @@ template<class T> struct AtomicHelper<8, T> {
volatile int64_t* loc_ptr =
reinterpret_cast<volatile int64_t*>(loc);
QuasiAtomic::Write64(loc_ptr,
- reinterpret_cast<int64_t>(desired));
+ static_cast<int64_t>(desired));
}
@@ -409,8 +409,8 @@ template<class T> struct AtomicHelper<8, T> {
// sizeof(T) == 8
volatile int64_t* loc_ptr = reinterpret_cast<volatile int64_t*>(loc);
return QuasiAtomic::Cas64(
- reinterpret_cast<int64_t>(expected_value),
- reinterpret_cast<int64_t>(desired_value), loc_ptr);
+ static_cast<int64_t>(reinterpret_cast<uintptr_t>(expected_value)),
+ static_cast<int64_t>(reinterpret_cast<uintptr_t>(desired_value)), loc_ptr);
}
};