Index: head/sys/riscv/include/atomic.h =================================================================== --- head/sys/riscv/include/atomic.h +++ head/sys/riscv/include/atomic.h @@ -182,7 +182,7 @@ "bnez %1, 0b\n" "1:" : "=&r" (tmp), "=&r" (res), "+A" (*p) - : "rJ" (cmpval), "rJ" (newval) + : "rJ" ((long)(int32_t)cmpval), "rJ" (newval) : "memory"); return (!res); @@ -207,7 +207,7 @@ "sw %0, %3\n" /* Save old value */ "2:" : "=&r" (tmp), "=&r" (res), "+A" (*p), "+A" (*cmpval) - : "rJ" (*cmpval), "rJ" (newval) + : "rJ" ((long)(int32_t)*cmpval), "rJ" (newval) : "memory"); return (!res);