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 with 1.18 program that succeeds with 1.18rc1 #51828

Open
bradenaw opened this issue Mar 20, 2022 · 5 comments
Open

cmd/compile: ICE with 1.18 program that succeeds with 1.18rc1 #51828

bradenaw opened this issue Mar 20, 2022 · 5 comments
Labels
NeedsInvestigation
Milestone

Comments

@bradenaw
Copy link

@bradenaw bradenaw commented Mar 20, 2022

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

$ go version
go version go1.18 linux/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/bw/.cache/go-build"
GOENV="/home/bw/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/bw/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/bw/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/bw/src/bergamot/go.mod"
GOWORK=""
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-build1251825903=/tmp/go-build -gno-record-gcc-switches"

What did you do?

go build ./... in https://github.com/bradenaw/bergamot a2e31c7e340800f186e9d382644399305f90e5b2

What did you expect to see?

Build succeeds, like with 1.18rc1:

  11:00:17 bw@Falcon ~/src/bergamot main
  ~> /home/bw/src/goroot/bin/go version
go version go1.18rc1 linux/amd64

  11:00:26 bw@Falcon ~/src/bergamot main
  ~> /home/bw/src/goroot/bin/go build ./...

  11:00:30 bw@Falcon ~/src/bergamot main
  ~>

What did you see instead?

~> go build ./...
# github.com/bradenaw/bergamot
<autogenerated>:1: internal compiler error: assigning node (type *xlist.Node["".kvPair[uint8,"".vAndRef[int]]]) to parameter xlist.node (type *xlist.Node[go.shape.struct { "".k uint8; "".v struct { "".v int; "".ref uint32 } }_0])

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new

The project is about 1000 lines of code. I can work on a smaller reproduction if that's helpful. Unfortunately the compiler error is not particularly insightful, since it's marked <autogenerated>:1. The right type definition looks to my untrained eyes like the expansion of the left.

@bradenaw
Copy link
Author

@bradenaw bradenaw commented Mar 20, 2022

git bisect suggests ce427cf96128b545ae473983bafb6a0b80ecaa08. Build succeeds with parent 79cf7c839bffa7d6c8a24620ae4670b7e08bf732.

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Mar 20, 2022

CC @cherrymui in case this is really due to https://go.dev/cl/388995.

CC @randall77 because the error message suggests a confusion between shape types and non-shape types.

@cuonglm
Copy link
Member

@cuonglm cuonglm commented Mar 21, 2022

git bisect points to eb8198d, which is https://go.dev/cl/387674.

cc @danscales

@mknyszek mknyszek changed the title Build fails with 1.18 that succeeds with 1.18rc1 cmd/compile: ICE with 1.18 program that succeeds with 1.18rc1 Mar 21, 2022
@mknyszek mknyszek added the NeedsInvestigation label Mar 21, 2022
@mknyszek mknyszek added this to the Go1.19 milestone Mar 21, 2022
@bradenaw
Copy link
Author

@bradenaw bradenaw commented Mar 24, 2022

@bradenaw
Copy link
Author

@bradenaw bradenaw commented Mar 24, 2022

Copying the xlist dependency into the package and using it locally also fixes the build, so it appears to require crossing a package boundary.

Here's a local-minimum reproduction:

package bergamot

import (
	"github.com/bradenaw/juniper/container/xlist"
)

type vAndRef[V any] struct {
	v V
}

type CAR struct {
	shortTerm mapList[vAndRef[int]]
}

var _ interface{} = &CAR{}

type mapList[V any] struct {
	l xlist.List[vAndRef[V]]
}

func (ml *mapList[V]) MoveToBack(node *xlist.Node[vAndRef[V]]) {
	ml.l.MoveToBack(node)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation
Projects
None yet
Development

No branches or pull requests

4 participants