Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: internal compiler error: large ONEW with EscNone: new() #11728

Closed
xi2 opened this issue Jul 15, 2015 · 5 comments
Closed

cmd/compile: internal compiler error: large ONEW with EscNone: new() #11728

xi2 opened this issue Jul 15, 2015 · 5 comments

Comments

@xi2
Copy link

xi2 commented Jul 15, 2015

Go version: +2e4b659 15/07/2015, OS: Debian Jessie AMD64

The following program fails to compile:

package main

type X struct {
    Array [1 << 16]byte
}

func main() {
    _ = &X{}
}

with the message

./test.go:8: internal compiler error: large ONEW with EscNone: new()
@dr2chase
Copy link
Contributor

You can work around that error by causing the pointer to escape.
E.g. someGlobal = &X{}

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jul 16, 2015
@nightlyone
Copy link
Contributor

Note: This is a regression. It doesn't happen with Go 1.4.2

@dr2chase
Copy link
Contributor

It's probably @rsc 's call if we want to try to tweak this for 1.5, but there was a lot of work done for escape analysis and some lurking bugs plugged. For this particular case (large data with no pointers allocated on stack) it could probably be allowed to pass, but if pointers are in the large data a phase-after-escape-analysis moves such large stack allocations to the heap, potentially leaking stack pointers into the heap. That is my recollection, at least -- we replaced a potential difficult-to-analyze Heisenbug with a compile-time-error with a workaround.

@paulmach
Copy link

Changing _ = &X{} to _ = new(X) allows it to compile. ie. the below works fine.

package main

type X struct {
    Array [1 << 16]byte
}

func main() {
    _ = new(X)
}

@ALTree
Copy link
Member

ALTree commented Jan 8, 2017

Same as #15733, fixed by d603c27 since go1.7.

@ALTree ALTree closed this as completed Jan 8, 2017
@golang golang locked and limited conversation to collaborators Jan 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants