Skip to content

redundant-atomic-result-assignment

Default severity: error

Reports an atomic update whose returned value is assigned back to the same variable. The assignment performs a second, non-atomic write and defeats the purpose of the atomic operation.

counter = atomic.AddInt64(&counter, 1)
atomic.AddInt64(&counter, 1)