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: ICE when compiling github.com/llgcode/draw2d/draw2dimg #24761

Closed
reusee opened this issue Apr 8, 2018 · 6 comments

Comments

Projects
None yet
5 participants
@reusee
Copy link

commented Apr 8, 2018

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

@davecheney

This comment has been minimized.

Copy link
Contributor

commented Apr 8, 2018

@reusee

This comment has been minimized.

Copy link
Author

commented Apr 8, 2018

introduced by

fa3e9d27f333d1cdb75889c2bff8e71d62f82e11 is the first bad commit
commit fa3e9d27f333d1cdb75889c2bff8e71d62f82e11
Author: Josh Bleecher Snyder <josharian@gmail.com>
Date:   Sun Apr 23 05:06:22 2017 -0700

    cmd/compile: compile all functions concurrently

@davecheney

This comment has been minimized.

Copy link
Contributor

commented Apr 8, 2018

Thank you. /cc @josharian

@davecheney davecheney added this to the Go1.11 milestone Apr 8, 2018

@mvdan

This comment has been minimized.

Copy link
Member

commented Apr 8, 2018

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.

@josharian

This comment has been minimized.

Copy link
Contributor

commented Apr 8, 2018

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

@gopherbot

This comment has been minimized.

Copy link

commented Apr 8, 2018

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

@gopherbot gopherbot closed this in 2dfb423 Apr 11, 2018

@golang golang locked and limited conversation to collaborators Apr 11, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.