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
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.
cmd/compile accepts this program, even though it involves a heap allocation of a go:notinheap type:
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.
/cc @aclements
The text was updated successfully, but these errors were encountered: