package main
import (
"fmt"
"unsafe"
)
type S struct {
p *byte
a string
b string
c int64
d int64
}
func main() {
s := &S{p: nil, a: "foo", b: "foo", c: 0, d: 0}
s.a = ""
s.b = "bar"
s.c = 33
z := (*[2]uintptr)(unsafe.Pointer(&s.a))
fmt.Printf("%x %x\n", z[0], z[1])
}
This prints 0 3 at tip, which is bad. That shows there is a string with a nil pointer but a nonzero length. Something is wrong with how stores are resolved when there are multiple stores to the same location (in this case, one in the struct literal, one explicit). At s.a = "", the store of s.a.ptr = nil is happening but the store of s.a.len = 0 is not.
I think this starts with CL 698097. I will revert that.
This prints
0 3at tip, which is bad. That shows there is a string with a nil pointer but a nonzero length. Something is wrong with how stores are resolved when there are multiple stores to the same location (in this case, one in the struct literal, one explicit). Ats.a = "", the store ofs.a.ptr = nilis happening but the store ofs.a.len = 0is not.I think this starts with CL 698097. I will revert that.