You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/compile: heap allocation of go:notinheap type via string conversion #28243
cmd/compile accepts this program, even though it involves a heap allocation of a go:notinheap type:
package p
//go:notinheap
type gcBits uint8
var x []gcBits
func f() {
x = []gcBits("foo") // ([]gcBits)("foo") escapes to heap
}
Unlikely that this would ever be written within package runtime, but seems worth preventing. I think it's just a matter of disallowing string -> []T conversions where T is go:notinheap, like how *T to *U conversions are already special-cased for go:notinheap in convertop.
Activity
gopherbot commentedon Oct 16, 2018
Change https://golang.org/cl/142719 mentions this issue:
cmd/compile: disallow converting string to notinheap slice