mirror of
https://github.com/golang/go
synced 2024-11-23 07:40:04 -07:00
933721b8c7
storeType splits compound stores up into a scalar parts and a pointer parts. The scalar part happens unconditionally, and the pointer part happens under the guard of a write barrier check. Types which are declared as pointers, but are represented as scalars because they might have "bad" values, were not handled correctly here. They ended up not getting stored in either set. Fixes #42032 Change-Id: I46f6600075c0c370e640b807066247237f93c7ac Reviewed-on: https://go-review.googlesource.com/c/go/+/264300 Trust: Keith Randall <khr@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
28 lines
391 B
Go
28 lines
391 B
Go
// run
|
|
|
|
// Copyright 2020 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
|
|
|
|
//go:notinheap
|
|
type NIH struct {
|
|
}
|
|
|
|
type T struct {
|
|
x *NIH
|
|
p *int
|
|
}
|
|
|
|
var y NIH
|
|
var z int
|
|
|
|
func main() {
|
|
a := []T{{&y, &z}}
|
|
a = append(a, T{&y, &z})
|
|
if a[1].x == nil {
|
|
panic("pointer not written")
|
|
}
|
|
}
|