#if defined(__GNUC__) || defined(__clang__)
/* These return the new value. */
-/* See: https://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html */
-#define POCL_ATOMIC_INC(x) __sync_add_and_fetch (&x, 1)
-#define POCL_ATOMIC_DEC(x) __sync_sub_and_fetch (&x, 1)
+/* See: https://gcc.gnu.org/onlinedocs/gcc-4.7.4/gcc/_005f_005fatomic-Builtins.html */
+#define POCL_ATOMIC_INC(x) __atomic_add_fetch (&x, 1, __ATOMIC_SEQ_CST)
+#define POCL_ATOMIC_DEC(x) __atomic_sub_fetch (&x, 1, __ATOMIC_SEQ_CST)
#elif defined(_WIN32)
#define POCL_ATOMIC_INC(x) InterlockedIncrement64 (&x)