]> Cypherpunks repositories - gostls13.git/commitdiff
sync/atomic: clarify 64-bit alignment bug
authorAustin Clements <austin@google.com>
Tue, 11 Jul 2017 15:03:36 +0000 (11:03 -0400)
committerAustin Clements <austin@google.com>
Tue, 11 Jul 2017 18:32:38 +0000 (18:32 +0000)
Local variables can also be relied on the be 64-bit aligned, since
they will be escaped to the heap if used with any atomic operations.

Also, allocated arrays are also aligned, just like structs and slices.

Fixes #18955.

Change-Id: I8a1897f6ff78922c8bfcf20d6eb4bcb17a70ba2d
Reviewed-on: https://go-review.googlesource.com/48112
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/sync/atomic/doc.go

index 302ff43070acccb45ff519574aac634074e69f6b..7c007d7a150c65c1c72db4b100e77480479500b5 100644 (file)
@@ -48,8 +48,8 @@ import (
 // On non-Linux ARM, the 64-bit functions use instructions unavailable before the ARMv6k core.
 //
 // On both ARM and x86-32, it is the caller's responsibility to arrange for 64-bit
-// alignment of 64-bit words accessed atomically. The first word in a global
-// variable or in an allocated struct or slice can be relied upon to be
+// alignment of 64-bit words accessed atomically. The first word in a
+// variable or in an allocated struct, array, or slice can be relied upon to be
 // 64-bit aligned.
 
 // SwapInt32 atomically stores new into *addr and returns the previous *addr value.