Hello! On Fri, 2023-09-22 at 09:20 +0200, John Paul Adrian Glaubitz wrote: > The attached patch fixes the issue for me. The underlying problem is > the use of legacy atomic functions for which no 64-bit variants exist > on some architectures [1]. See also the upstream discussion here [2].
Attaching an updated version of the patch which applies against the 9.4.7-1 version of the ghc package. Would be nice if it could be included for the next upload. Thanks, Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
--- ghc-9.4.7.orig/libraries/ghc-prim/cbits/atomic.c +++ ghc-9.4.7/libraries/ghc-prim/cbits/atomic.c @@ -291,28 +291,28 @@ extern StgWord hs_cmpxchg8(StgWord x, St StgWord hs_cmpxchg8(StgWord x, StgWord old, StgWord new) { - return __sync_val_compare_and_swap((volatile StgWord8 *) x, (StgWord8) old, (StgWord8) new); + return __atomic_compare_exchange((volatile StgWord8 *) x, (StgWord8 *) &old, (StgWord8 *) &new, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); } extern StgWord hs_cmpxchg16(StgWord x, StgWord old, StgWord new); StgWord hs_cmpxchg16(StgWord x, StgWord old, StgWord new) { - return __sync_val_compare_and_swap((volatile StgWord16 *) x, (StgWord16) old, (StgWord16) new); + return __atomic_compare_exchange((volatile StgWord16 *) x, (StgWord16 *) &old, (StgWord16 *) &new, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); } extern StgWord hs_cmpxchg32(StgWord x, StgWord old, StgWord new); StgWord hs_cmpxchg32(StgWord x, StgWord old, StgWord new) { - return __sync_val_compare_and_swap((volatile StgWord32 *) x, (StgWord32) old, (StgWord32) new); + return __atomic_compare_exchange((volatile StgWord32 *) x, (StgWord32 *) &old, (StgWord32 *) &new, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); } 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); + return __atomic_compare_exchange((volatile StgWord64 *) x, (StgWord64 *) &old, (StgWord64 *) &new, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); } // Atomic exchange operations