* os_dep.c [SVR4 || AUX || DGUX || LINUX && SPARC]
(GC_SysVGetDataStart): Use AO_fetch_and_add(p,0) if available instead
of non-atomic read/write in *p = *p statement (thus, to avoid data race
though it is highly unlikely).
GC_setup_temporary_fault_handler();
if (SETJMP(GC_jmp_buf) == 0) {
/* Try writing to the address. */
- char v = *result;
-# if defined(CPPCHECK)
- GC_noop1((word)&v);
+# ifdef AO_HAVE_fetch_and_add
+ volatile AO_t zero = 0;
+ (void)AO_fetch_and_add((volatile AO_t *)result, zero);
+# else
+ /* Fallback to non-atomic fetch-and-store. */
+ char v = *result;
+# if defined(CPPCHECK)
+ GC_noop1((word)&v);
+# endif
+ *result = v;
# endif
- *result = v;
GC_reset_fault_handler();
} else {
GC_reset_fault_handler();