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
This:
package main
func main() {
var buf [1<<31]byte
buf[len(buf)-1] = 0
}
generates:
large.go:3: stack frame too large (>2GB)
If that's too large, why isn't it just heap-promoted?
This works fine:
package main
var ptr *byte
func main() {
var buf [1<<31]byte
buf[len(buf)-1] = 0
ptr = &buf[0]
}
But this:
package main
/*
*/
import "C"
import "unsafe"
func main() {
var buf [1<<31 + 2]byte
for i := range buf {
buf[i] = 'a'
}
buf[len(buf)-1] = 0 // ERROR: offset 2147483649 too large for OINDREG
println(len(C.GoString((*C.char)(unsafe.Pointer(&buf[0])))))
}
Yields: x.go:15: offset 2147483649 too large for OINDREG
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: