Skip to content

cmd/compile: internal compiler error: assertion failed #54135

@r-hang

Description

@r-hang

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

master
$ go version
go version devel go1.19-5c8ec89cb5 Thu Jul 28 21:13:04 2022 +0000 linux/amd64

Does this issue reproduce with the latest release?

Fails on both go1.19rc2 and master. Passes on go1.18.

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

go env Output
$ go env
GO111MODULE="off"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/user/go-code2/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/user/go-code2"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org/,direct"
GOROOT="/home/user/go/src/github.com/golang/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/user/go/src/github.com/golang/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel go1.19-5c8ec89cb5 Thu Jul 28 21:13:04 2022 +0000"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3108614045=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Try compiling this test program

package main

import (
	"fmt"
	"testing"
)

type Bar[T any] interface{
    Blanker()
}

type FooBar[T any] interface{}

type Foo[E comparable] struct {
	me E
}

func (b *Foo[E]) do(h Bar[E], f FooBar[E]) {
	check(h, f)
}

func check[T comparable](p Bar[T], q FooBar[T]) int {
	if _, ok := p.(Checkable); ok {
		fmt.Println(ok)
	}
	if _, ok := q.(Checkable); ok {
		fmt.Println(ok)
	}
	return 1
}

type Checkable interface{}

func TestFunction(m *testing.T) {
	x := Foo[int]{me: 2}
	fmt.Println(x)
}

What did you expect to see?

Test passed.

What did you see instead?

./main_test.go:19:7: internal compiler error: assertion failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions