--- cffi-2.0.0/src/c/misc_win32.h.orig	2025-09-08 23:59:32.000000000 +0200
+++ cffi-2.0.0/src/c/misc_win32.h	2025-09-09 19:02:37.302712500 +0200
@@ -275,7 +275,9 @@
 
 static void *cffi_atomic_load(void **ptr)
 {
-#if defined(_M_X64) || defined(_M_IX86)
+#if defined(__GNUC__) || defined(__clang__)
+    return __atomic_load_n(ptr, __ATOMIC_SEQ_CST);
+#elif defined(_M_X64) || defined(_M_IX86)
     return *(volatile void **)ptr;
 #elif defined(_M_ARM64)
     return (void *)__ldar64((volatile unsigned __int64 *)ptr);
@@ -286,7 +288,9 @@
 
 static uint8_t cffi_atomic_load_uint8(uint8_t *ptr)
 {
-#if defined(_M_X64) || defined(_M_IX86)
+#if defined(__GNUC__) || defined(__clang__)
+    return __atomic_load_n(ptr, __ATOMIC_SEQ_CST);
+#elif defined(_M_X64) || defined(_M_IX86)
     return *(volatile uint8_t *)ptr;
 #elif defined(_M_ARM64)
     return (uint8_t)__ldar8((volatile uint8_t *)ptr);
@@ -297,7 +301,9 @@
 
 static Py_ssize_t cffi_atomic_load_ssize(Py_ssize_t *ptr)
 {
-#if defined(_M_X64) || defined(_M_IX86)
+#if defined(__GNUC__) || defined(__clang__)
+    return __atomic_load_n(ptr, __ATOMIC_SEQ_CST);
+#elif defined(_M_X64) || defined(_M_IX86)
     return *(volatile Py_ssize_t *)ptr;
 #elif defined(_M_ARM64)
     return (Py_ssize_t)__ldar64((volatile unsigned __int64 *)ptr);
@@ -308,17 +314,29 @@
 
 static void cffi_atomic_store_ssize(Py_ssize_t *ptr, Py_ssize_t value)
 {
+#if defined(__GNUC__) || defined(__clang__)
+    __atomic_store_n(ptr, value, __ATOMIC_SEQ_CST);
+#else
     _InterlockedExchangePointer(ptr, value);
+#endif
 }
 
 static void cffi_atomic_store(void **ptr, void *value)
 {
+#if defined(__GNUC__) || defined(__clang__)
+    __atomic_store_n(ptr, value, __ATOMIC_SEQ_CST);
+#else
     _InterlockedExchangePointer(ptr, value);
+#endif
 }
 
 static void cffi_atomic_store_uint8(uint8_t *ptr, uint8_t value)
 {
+#if defined(__GNUC__) || defined(__clang__)
+    __atomic_store_n(ptr, value, __ATOMIC_SEQ_CST);
+#else
     _InterlockedExchange8(ptr, value);
+#endif
 }
 
 #endif /* CFFI_MISC_WIN32_H */
