提交 83350eb1 编写于 作者: L Luís Marques 提交者: Rich Felker

fix riscv64 a_cas inline asm operand sign extension

This patch adds an explicit cast to the int arguments passed to the
inline asm used in the RISC-V's implementation of `a_cas`, to ensure
that they are properly sign extended to 64 bits. They aren't
automatically sign extended by Clang, and GCC technically also doesn't
guarantee that they will be sign extended.
上级 a2e71304
...@@ -15,7 +15,7 @@ static inline int a_cas(volatile int *p, int t, int s) ...@@ -15,7 +15,7 @@ static inline int a_cas(volatile int *p, int t, int s)
" bnez %1, 1b\n" " bnez %1, 1b\n"
"1:" "1:"
: "=&r"(old), "=&r"(tmp) : "=&r"(old), "=&r"(tmp)
: "r"(p), "r"(t), "r"(s) : "r"(p), "r"((long)t), "r"((long)s)
: "memory"); : "memory");
return old; return old;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册