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
diff --git a/runtime/atomic.h b/runtime/atomic.h
index 04daea8..ed83a33 100644
--- a/runtime/atomic.h
+++ b/runtime/atomic.h
@@ -392,7 +392,7 @@
// 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 @@
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 @@
// 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);
}
};