-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Milestone
Description
The following code prints 2!
package main
var a[1<<31]byte
func main() {
println(a[0])
}
It seems that when bss is big, bad things happen on darwin. At 1<<30, it works (prints 0). It also fails at 1<<31, 1<<32, 1<<33. We get a compile error at 1<<31 - 1:
runtime.mallocinit: non-pc-relative relocation address is too big: 0x80070dbf
We should fail instead of silently generating bad code.
Linux works correctly: succeeds for up to close to 1<<32, fails with the above error for larger sizes.