Go: cmd/compile: ICE when compiling github.com/llgcode/draw2d/draw2dimg

Created on 8 Apr 2018  Â·  6Comments  Â·  Source: golang/go

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

go version devel +c00c1efbd8 Sun Apr 8 05:22:26 2018 +0000 linux/amd64

Does this issue reproduce with the latest release?

yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/reus/.go-cache"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/reus/go"
GORACE=""
GOROOT="/home/reus/gotip"
GOTMPDIR=""
GOTOOLDIR="/home/reus/gotip/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build524165607=/tmp/go-build -gno-record-gcc-switches"

What did you do?

download github.com/llgcode/draw2d/draw2dimg and build

What did you expect to see?

build ok

What did you see instead?

build failed

# github.com/llgcode/draw2d/draw2dimg
<autogenerated>:1: internal compiler error: 4 uncompiled functions

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
    /home/reus/gotip/src/runtime/debug/stack.go:24 +0xa7
cmd/compile/internal/gc.Fatalf(0xbca91c, 0x17, 0xc000b37a50, 0x1, 0x1)
    /home/reus/gotip/src/cmd/compile/internal/gc/subr.go:182 +0x1f7
cmd/compile/internal/gc.Main(0xbdd9c8)
    /home/reus/gotip/src/cmd/compile/internal/gc/main.go:683 +0x2ad7
main.main()
    /home/reus/gotip/src/cmd/compile/main.go:49 +0x96

FrozenDueToAge NeedsFix release-blocker

Most helpful comment

I managed to reduce this to two packages and less than 20 lines of Go:

$ go list .
mvdan.cc/p1
$ cat f1.go
package p1

import "mvdan.cc/p1/p2"

type T1 struct {
        *p2.T2
}
$ cat p2/f2.go
package p2

type T2 struct{}

func (t *T2) M2(a, b float64) {
        variadic(a, b)
}

func variadic(points ...float64) {
        println(points)
}
$ go build
# mvdan.cc/p1
<autogenerated>:1: internal compiler error: 2 uncompiled functions

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
        /home/mvdan/tip/src/runtime/debug/stack.go:24 +0xa7
cmd/compile/internal/gc.Fatalf(0xbca87c, 0x17, 0xc000365a50, 0x1, 0x1)
        /home/mvdan/tip/src/cmd/compile/internal/gc/subr.go:182 +0x1f7
cmd/compile/internal/gc.Main(0xbdd928)
        /home/mvdan/tip/src/cmd/compile/internal/gc/main.go:683 +0x2ad7
main.main()
        /home/mvdan/tip/src/cmd/compile/main.go:49 +0x96

It seems like all of these are required to reproduce the crash:

  • Two packages. Potentially related to import/export data.
  • Struct embedding.
  • Variadic arguments.
  • float64. If it's changed to int for example, it no longer crashes.

I've gotten a bit stuck trying to reduce it further. But at least it no longer involves dozens of image drawing packages.

All 6 comments

Thank you for raising this issue. Could you do a little bisecting and see if you can figure out when this was introduced?

On 8 Apr 2018, at 17:27, reusee notifications@github.com wrote:

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

go version devel +c00c1efbd8 Sun Apr 8 05:22:26 2018 +0000 linux/amd64

Does this issue reproduce with the latest release?

yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/reus/.go-cache"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/reus/go"
GORACE=""
GOROOT="/home/reus/gotip"
GOTMPDIR=""
GOTOOLDIR="/home/reus/gotip/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build524165607=/tmp/go-build -gno-record-gcc-switches"

What did you do?

download github.com/llgcode/draw2d/draw2dimg and build

What did you expect to see?

build ok

What did you see instead?

build failed

github.com/llgcode/draw2d/draw2dimg

:1: internal compiler error: 4 uncompiled functions

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
/home/reus/gotip/src/runtime/debug/stack.go:24 +0xa7
cmd/compile/internal/gc.Fatalf(0xbca91c, 0x17, 0xc000b37a50, 0x1, 0x1)
/home/reus/gotip/src/cmd/compile/internal/gc/subr.go:182 +0x1f7
cmd/compile/internal/gc.Main(0xbdd9c8)
/home/reus/gotip/src/cmd/compile/internal/gc/main.go:683 +0x2ad7
main.main()
/home/reus/gotip/src/cmd/compile/main.go:49 +0x96

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

introduced by

fa3e9d27f333d1cdb75889c2bff8e71d62f82e11 is the first bad commit
commit fa3e9d27f333d1cdb75889c2bff8e71d62f82e11
Author: Josh Bleecher Snyder <[email protected]>
Date:   Sun Apr 23 05:06:22 2017 -0700

    cmd/compile: compile all functions concurrently

Thank you. /cc @josharian

I managed to reduce this to two packages and less than 20 lines of Go:

$ go list .
mvdan.cc/p1
$ cat f1.go
package p1

import "mvdan.cc/p1/p2"

type T1 struct {
        *p2.T2
}
$ cat p2/f2.go
package p2

type T2 struct{}

func (t *T2) M2(a, b float64) {
        variadic(a, b)
}

func variadic(points ...float64) {
        println(points)
}
$ go build
# mvdan.cc/p1
<autogenerated>:1: internal compiler error: 2 uncompiled functions

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
        /home/mvdan/tip/src/runtime/debug/stack.go:24 +0xa7
cmd/compile/internal/gc.Fatalf(0xbca87c, 0x17, 0xc000365a50, 0x1, 0x1)
        /home/mvdan/tip/src/cmd/compile/internal/gc/subr.go:182 +0x1f7
cmd/compile/internal/gc.Main(0xbdd928)
        /home/mvdan/tip/src/cmd/compile/internal/gc/main.go:683 +0x2ad7
main.main()
        /home/mvdan/tip/src/cmd/compile/main.go:49 +0x96

It seems like all of these are required to reproduce the crash:

  • Two packages. Potentially related to import/export data.
  • Struct embedding.
  • Variadic arguments.
  • float64. If it's changed to int for example, it no longer crashes.

I've gotten a bit stuck trying to reduce it further. But at least it no longer involves dozens of image drawing packages.

Nice find! Thanks, @mvdan, for the minimized test case, it was very helpful.

Change https://golang.org/cl/105615 mentions this issue: cmd/compile: loop to ensure all autogenerated functions are compiled

Was this page helpful?
0 / 5 - 0 ratings