From 977e23a70766f8d0801e43bbfb68136bf54a84b7 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 31 Jul 2023 14:01:00 -0400 Subject: [PATCH] doc/go_mem: explain arrays, structs, and complex numbers Arrays, structs, and complex numbers are collections of values that are handled separately by the memory model. An earlier version may have said this, but the current version does not. Say it. Change-Id: If3928bed6659e58e688f88aa0dde05423cbb3820 Reviewed-on: https://go-review.googlesource.com/c/go/+/514476 Run-TryBot: Russ Cox TryBot-Result: Gopher Robot Reviewed-by: Matthew Dempsky Reviewed-by: Ian Lance Taylor --- doc/go_mem.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/go_mem.html b/doc/go_mem.html index 661e1e781c..e0a7539472 100644 --- a/doc/go_mem.html +++ b/doc/go_mem.html @@ -221,7 +221,7 @@ for programs that do contain races.

-First, any implementation can, upon detecting a data race, +Any implementation can, upon detecting a data race, report the race and halt execution of the program. Implementations using ThreadSanitizer (accessed with “go build -race”) @@ -229,7 +229,18 @@ do exactly this.

-Otherwise, a read r of a memory location x +A read of an array, struct, or complex number +may by implemented as a read of each individual sub-value +(array element, struct field, or real/imaginary component), +in any order. +Similarly, a write of an array, struct, or complex number +may be implemented as a write of each individual sub-value, +in any order. +

+ +

+A read r of a memory location x +holding a value that is not larger than a machine word must observe some write w such that r does not happen before w and there is no write w' such that w happens before w' -- 2.44.0