test: add write barrier test Update #80196 Change-Id: If121610638034f782aed14c9dc054eba42662d4d Reviewed-on: https://go-review.googlesource.com/c/go/+/795360 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/test/fixedbugs/issue80196.go b/test/fixedbugs/issue80196.go new file mode 100644 index 0000000..3063280 --- /dev/null +++ b/test/fixedbugs/issue80196.go
@@ -0,0 +1,33 @@ +// run + +// Copyright 2026 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +type S [5]*byte + +//go:noinline +func f() S { + return S{} +} + +var sink *S + +//go:noinline +func g() (s S) { + sink = &s + s = f() + return +} + +func main() { + for i := range 1000000 { + s := g() + if s != (S{}) { + println(s[0], s[1], s[2], s[3], s[4]) + panic(i) + } + } +}