提交 de400b66 编写于 作者: R Rich Felker

correct pointer types for a_ll_p and a_sc_p primitives on mips64

these changes should not affect generated code, but they reflect that
the underlying objects operated on by a_cas_p are supposed to have
type volatile void *, not volatile long. in theory a compiler could
treat the effective type mismatch in the "m" memory operands as
undefined behavior.
上级 27bf42cd
...@@ -19,22 +19,22 @@ static inline int a_sc(volatile int *p, int v) ...@@ -19,22 +19,22 @@ static inline int a_sc(volatile int *p, int v)
} }
#define a_ll_p a_ll_p #define a_ll_p a_ll_p
static inline void *a_ll_p(volatile long *p) static inline void *a_ll_p(volatile void *p)
{ {
void *v; void *v;
__asm__ __volatile__ ( __asm__ __volatile__ (
"lld %0, %1" "lld %0, %1"
: "=r"(v) : "m"(*p)); : "=r"(v) : "m"(*(void *volatile *)p));
return v; return v;
} }
#define a_sc_p a_sc_p #define a_sc_p a_sc_p
static inline int a_sc_p(volatile long *p, void *v) static inline int a_sc_p(volatile void *p, void *v)
{ {
long r; long r;
__asm__ __volatile__ ( __asm__ __volatile__ (
"scd %0, %1" "scd %0, %1"
: "=r"(r), "=m"(*p) : "0"(v) : "memory"); : "=r"(r), "=m"(*(void *volatile *)p) : "0"(v) : "memory");
return r; return r;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册