summaryrefslogtreecommitdiff
path: root/ruby_atomic.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-05 00:56:52 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-05 00:56:52 (GMT)
commite65f38b97d59002eb8161e41bb7f1a479f255d15 (patch)
treefa79fe2727de63e42a80486c56e6b0655b171b79 /ruby_atomic.h
parentc5d2ef80a47184965be3c220ec173d90aa968074 (diff)
ruby_atomic.h: fix old value type of ATOMIC_CAS
* ruby_atomic.h (ATOMIC_CAS): old value to be swapped should be same as the destination. immediate value may need type promotion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby_atomic.h')
-rw-r--r--ruby_atomic.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/ruby_atomic.h b/ruby_atomic.h
index c8c84ed..4bc9f37 100644
--- a/ruby_atomic.h
+++ b/ruby_atomic.h
@@ -10,7 +10,7 @@ typedef unsigned int rb_atomic_t;
# define ATOMIC_OR(var, val) __atomic_fetch_or(&(var), (val), __ATOMIC_SEQ_CST)
# define ATOMIC_EXCHANGE(var, val) __atomic_exchange_n(&(var), (val), __ATOMIC_SEQ_CST)
# define ATOMIC_CAS(var, oldval, newval) \
-({ __typeof__(oldval) oldvaldup = (oldval); /* oldval should not be modified */ \
+({ __typeof__(var) oldvaldup = (oldval); /* oldval should not be modified */ \
__atomic_compare_exchange_n(&(var), &oldvaldup, (newval), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); \
oldvaldup; })