[go-nuts] Re: compile time error vs runtime crash for same array

2021-11-26 Thread tapi...@gmail.com
There is an issue for this: https://github.com/golang/go/issues/17378 On Sunday, November 14, 2021 at 1:46:29 AM UTC+8 arthurwil...@gmail.com wrote: > On a 64bit Mac, this code: > > package main > > var X [^uint(0)>>14]byte > func main() { > } > > produces a compile time error: > main.X: symbol

[go-nuts] Re: compile time error vs runtime crash for same array

2021-11-26 Thread tapi...@gmail.com
It is 1 << 50 is the limit on heap. The following code doesn't compile: package main func main() { var X [1 << 50]byte // type [1125899906842624]byte larger than address space _ = X } But with 1 << 50 - 1, it compiles: package main func main() { var X [1 << 50 - 1]byte // runtime:

Re: [go-nuts] Re: compile time error vs runtime crash for same array

2021-11-25 Thread Jan Mercl
The linker knows nothing about heap. That's a runtime only thing. On Fri, Nov 26, 2021, 05:00 arthurwil...@gmail.com < arthurwilliammor...@gmail.com> wrote: > > On Saturday, November 13, 2021 at 12:48:41 PM UTC-6 seank...@gmail.com > wrote: > >> global variables are stored in there data section o

[go-nuts] Re: compile time error vs runtime crash for same array

2021-11-25 Thread arthurwil...@gmail.com
On Saturday, November 13, 2021 at 12:48:41 PM UTC-6 seank...@gmail.com wrote: > global variables are stored in there data section of the compiled binary, > the linker imposes a 2GB size limit > the array in main can be allocated at runtime, and given enough memory, it > could succeed > > Why d

[go-nuts] Re: compile time error vs runtime crash for same array

2021-11-13 Thread Sean Liao
global variables are stored in there data section of the compiled binary, the linker imposes a 2GB size limit the array in main can be allocated at runtime, and given enough memory, it could succeed On Saturday, November 13, 2021 at 5:46:29 PM UTC arthurwil...@gmail.com wrote: > On a 64bit Ma