From c515fb5148f1d81d5f7736825e14c7502c15432a Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 26 Nov 2012 16:42:38 -0800 Subject: Cast to __intptr_t before casting pointer to int64 --- sysdeps/x86_64/bits/atomic.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'sysdeps') diff --git a/sysdeps/x86_64/bits/atomic.h b/sysdeps/x86_64/bits/atomic.h index 100943fa1e..552581c46e 100644 --- a/sysdeps/x86_64/bits/atomic.h +++ b/sysdeps/x86_64/bits/atomic.h @@ -18,6 +18,7 @@ #include #include /* For tcbhead_t. */ +#include typedef int8_t atomic8_t; @@ -101,8 +102,9 @@ typedef uintmax_t uatomic_max_t; "lock\n" \ "0:\tcmpxchgq %q2, %1" \ : "=a" (ret), "=m" (*mem) \ - : "q" ((atomic64_t) (newval)), "m" (*mem), \ - "0" ((atomic64_t) (oldval)), \ + : "q" ((atomic64_t) cast_to_integer (newval)), \ + "m" (*mem), \ + "0" ((atomic64_t) cast_to_integer (oldval)), \ "i" (offsetof (tcbhead_t, multiple_threads))); \ ret; }) @@ -125,7 +127,8 @@ typedef uintmax_t uatomic_max_t; else \ __asm __volatile ("xchgq %q0, %1" \ : "=r" (result), "=m" (*mem) \ - : "0" ((atomic64_t) (newvalue)), "m" (*mem)); \ + : "0" ((atomic64_t) cast_to_integer (newvalue)), \ + "m" (*mem)); \ result; }) @@ -149,7 +152,8 @@ typedef uintmax_t uatomic_max_t; else \ __asm __volatile (lock "xaddq %q0, %1" \ : "=r" (result), "=m" (*mem) \ - : "0" ((atomic64_t) (value)), "m" (*mem), \ + : "0" ((atomic64_t) cast_to_integer (value)), \ + "m" (*mem), \ "i" (offsetof (tcbhead_t, multiple_threads))); \ result; }) @@ -187,7 +191,8 @@ typedef uintmax_t uatomic_max_t; else \ __asm __volatile (lock "addq %q1, %0" \ : "=m" (*mem) \ - : "ir" ((atomic64_t) (value)), "m" (*mem), \ + : "ir" ((atomic64_t) cast_to_integer (value)), \ + "m" (*mem), \ "i" (offsetof (tcbhead_t, multiple_threads))); \ } while (0) @@ -218,7 +223,8 @@ typedef uintmax_t uatomic_max_t; else \ __asm __volatile (LOCK_PREFIX "addq %q2, %0; sets %1" \ : "=m" (*mem), "=qm" (__result) \ - : "ir" ((atomic64_t) (value)), "m" (*mem)); \ + : "ir" ((atomic64_t) cast_to_integer (value)), \ + "m" (*mem)); \ __result; }) @@ -239,7 +245,8 @@ typedef uintmax_t uatomic_max_t; else \ __asm __volatile (LOCK_PREFIX "addq %q2, %0; setz %1" \ : "=m" (*mem), "=qm" (__result) \ - : "ir" ((atomic64_t) (value)), "m" (*mem)); \ + : "ir" ((atomic64_t) cast_to_integer (value)), \ + "m" (*mem)); \ __result; }) -- cgit v1.2.3