diff --git a/compiler-rt/lib/builtins/atomic.c b/compiler-rt/lib/builtins/atomic.c --- a/compiler-rt/lib/builtins/atomic.c +++ b/compiler-rt/lib/builtins/atomic.c @@ -225,8 +225,10 @@ } /// Performs an atomic exchange operation between two pointers. This is atomic -/// with respect to the target address. -void __atomic_exchange_c(int size, void *ptr, void *val, void *old, int model) { +/// with respect to the target address. ptr, val and old should not alias each +/// other. +void __atomic_exchange_c(int size, void *restrict ptr, void *restrict val, + void *restrict old, int model) { #define LOCK_FREE_ACTION(type) \ *(type *)old = \ __c11_atomic_exchange((_Atomic(type) *)ptr, *(type *)val, model); \