Skip to content

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

Closed

Description

@bradenaw

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.

Activity

  1. bradenaw commented on Mar 20, 2022

    @bradenaw
    Author

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

  2. ianlancetaylor commented on Mar 20, 2022

    @ianlancetaylor
    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.

  3. cuonglm commented on Mar 21, 2022

    @cuonglm
    Member

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

    cc @danscales

  4. 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[/+] on Mar 21, 2022
  5. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Mar 21, 2022
  6. added this to the Go1.19 milestone on Mar 21, 2022
  7. bradenaw commented on Mar 24, 2022

    @bradenaw
    Author
  8. bradenaw commented on Mar 24, 2022

    @bradenaw
    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)
    }
    
  9. bradenaw commented on Jun 20, 2022

    @bradenaw
    Author

    This project builds successfully with go1.19beta1.

  10. locked and limited conversation to collaborators on Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions