diff options
author | Cheng Shao <terrorjack@type.dance> | 2023-02-27 19:11:27 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-02-28 05:59:15 -0500 |
commit | 9fa545722f9151781344446dd5501db38cb90dd1 (patch) | |
tree | bb44bb2d7126236f7617030dab1b23cc935c8c50 /libraries | |
parent | 29a04d6e6e999bf907ba01ea0cb2f3af9f76f558 (diff) | |
download | haskell-9fa545722f9151781344446dd5501db38cb90dd1.tar.gz |
ghc-prim: fix hs_cmpxchg64 function prototype
hs_cmpxchg64 must return a StgWord64, otherwise incorrect runtime
results of 64-bit MO_Cmpxchg will appear in 32-bit unregisterised
builds, which go unnoticed at compile-time due to C implicit casting
in .hc files.
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/ghc-prim/cbits/atomic.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libraries/ghc-prim/cbits/atomic.c b/libraries/ghc-prim/cbits/atomic.c index 2ac6d26e1f..c15c596ddd 100644 --- a/libraries/ghc-prim/cbits/atomic.c +++ b/libraries/ghc-prim/cbits/atomic.c @@ -308,8 +308,8 @@ hs_cmpxchg32(StgWord x, StgWord old, StgWord new) return __sync_val_compare_and_swap((volatile StgWord32 *) x, (StgWord32) old, (StgWord32) new); } -extern StgWord hs_cmpxchg64(StgWord x, StgWord64 old, StgWord64 new); -StgWord +extern StgWord64 hs_cmpxchg64(StgWord x, StgWord64 old, StgWord64 new); +StgWord64 hs_cmpxchg64(StgWord x, StgWord64 old, StgWord64 new) { return __sync_val_compare_and_swap((volatile StgWord64 *) x, old, new); |