-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Closed
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
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.
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
Status
Done