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

Closed
bradenaw opened this issue Mar 20, 2022 · 6 comments
Closed

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

bradenaw opened this issue Mar 20, 2022 · 6 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@bradenaw
Copy link

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

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

@ianlancetaylor
Copy link
Contributor

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 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 Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 21, 2022
@mknyszek mknyszek added this to the Go1.19 milestone Mar 21, 2022
@bradenaw
Copy link
Author

Removing this line causes the build to succeed:
https://github.com/bradenaw/bergamot/blob/a2e31c7e340800f186e9d382644399305f90e5b2/car.go#L67

@bradenaw
Copy link
Author

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)
}

@bradenaw
Copy link
Author

This project builds successfully with go1.19beta1.

@golang golang locked and limited conversation to collaborators Jun 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Development

No branches or pull requests

5 participants