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: esc return list #15141

Closed
ericlagergren opened this issue Apr 5, 2016 · 7 comments
Closed

cmd/compile: internal compiler error: esc return list #15141

ericlagergren opened this issue Apr 5, 2016 · 7 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ericlagergren
Copy link
Contributor

FWIW this may be a duplicate of another issue I remember seeing. I skimmed through and could not find it, thus thus issue.

  1. What version of Go are you using (go version)?

1.6

  1. What operating system and processor architecture are you using (go env)?

GOOS="linux"
GOARCH="amd64"

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.
    A link on play.golang.org is best.

https://play.golang.org/p/IccuDHNXXu

It seems any array size over 0xA00000 triggers this error.

  1. What did you expect to see?

No compiler error.

  1. What did you see instead?

prog.go:8: internal compiler error: esc return list

@bradfitz
Copy link
Contributor

bradfitz commented Apr 5, 2016

Fails at tip too (but now with a stack trace, thanks to a recent change).

$ go build crash.go 
# command-line-arguments
./crash.go:8: internal compiler error: esc return list

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
        /home/bradfitz/go/src/runtime/debug/stack.go:24 +0x6f
cmd/compile/internal/gc.Fatalf(0x88e7b5, 0xf, 0x0, 0x0, 0x0)
        /home/bradfitz/go/src/cmd/compile/internal/gc/subr.go:158 +0x244
cmd/compile/internal/gc.esc(0xc8200cb0e0, 0xc82043db00, 0xc82043d7a0)
        /home/bradfitz/go/src/cmd/compile/internal/gc/esc.go:833 +0x13ae
cmd/compile/internal/gc.esclist(0xc8200cb0e0, 0xc8203f9420, 0xc82043d7a0)
        /home/bradfitz/go/src/cmd/compile/internal/gc/esc.go:602 +0x5a
cmd/compile/internal/gc.escfunc(0xc8200cb0e0, 0xc82043d7a0)
        /home/bradfitz/go/src/cmd/compile/internal/gc/esc.go:544 +0x1af
cmd/compile/internal/gc.escAnalyze(0xc82002cc68, 0x1, 0x1, 0xc820459a00)
        /home/bradfitz/go/src/cmd/compile/internal/gc/esc.go:467 +0x4d2
cmd/compile/internal/gc.(*bottomUpVisitor).visit(0xc820459b50, 0xc82043d7a0, 0xc800000002)
        /home/bradfitz/go/src/cmd/compile/internal/gc/esc.go:106 +0x2cd
cmd/compile/internal/gc.visitBottomUp(0xc8203fb4d0, 0x2, 0x2, 0x8e3758)
        /home/bradfitz/go/src/cmd/compile/internal/gc/esc.go:62 +0xb7
cmd/compile/internal/gc.escapes(0xc8203fb4d0, 0x2, 0x2)
        /home/bradfitz/go/src/cmd/compile/internal/gc/esc.go:186 +0x41
cmd/compile/internal/gc.Main()
        /home/bradfitz/go/src/cmd/compile/internal/gc/main.go:456 +0x195c
cmd/compile/internal/amd64.Main()
        /home/bradfitz/go/src/cmd/compile/internal/amd64/galign.go:104 +0x3c7
main.main()
        /home/bradfitz/go/src/cmd/compile/main.go:32 +0x25a

@bradfitz bradfitz added this to the Go1.7 milestone Apr 5, 2016
@OneOfOne
Copy link
Contributor

OneOfOne commented Apr 5, 2016

If you replace return a with just return, it works fine.

@dr2chase
Copy link
Contributor

dr2chase commented Apr 5, 2016

There's something wrong with the too-large-for-stack transformation in addrescapes in gen.go, it will take me a while to figure out what's going on.

@dr2chase
Copy link
Contributor

dr2chase commented Apr 6, 2016

Below, f and g work, h does not.

package main

func main() {
    a := f(1, 99)
    b := g(0xFFFFFFe, 98)
    println(a[1], b[1], a[0xFFFFFFe], b[0xFFFFFFe])
}

func f(i, y int) (a [0xFFFFFFF]byte) {
    a[i] = byte(y)
    return
}

func g(i, y int) [0xFFFFFFF]byte {
    var a [0xFFFFFFF]byte
    a[i] = byte(y)
    return a
}

// func h(i, y int) (a [0xFFFFFFF]byte) {
//  a[i] = byte(y)
//  return a
// }

@mdempsky mdempsky modified the milestones: Go1.8, Go1.7 May 18, 2016
@mdempsky
Copy link
Member

Issue preexisting in Go 1.6.

@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 11, 2016
@rsc rsc modified the milestones: Go1.9Early, Go1.8 Oct 21, 2016
@dr2chase
Copy link
Contributor

No longer reproduces.

@gopherbot
Copy link

CL https://golang.org/cl/31972 mentions this issue.

gopherbot pushed a commit that referenced this issue Oct 25, 2016
Bug 15141 was apparently fixed by some other change to the
compiler (this is plausible, it was a weird bug dependent
on a particular way of returning a large named array result),
add the test to ensure that it stays fixed.

Updates #15141.

Change-Id: I3d6937556413fab1af31c5a1940e6931563ce2f3
Reviewed-on: https://go-review.googlesource.com/31972
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@golang golang locked and limited conversation to collaborators Oct 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

8 participants