Skip to content

cmd/compile: internal compiler error: missing typecheck #56727

Closed
@biffen

Description

@biffen

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

$ go version
go version go1.19.3 linux/amd64

Does this issue reproduce with the latest release?

Yes (v1.19.3).

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/biffen/.cache/go-build"
GOENV="/home/biffen/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/biffen/.local/go/pkg/mod"
GONOPROXY="███"
GONOSUMDB="███"
GOOS="linux"
GOPATH="/home/biffen/.local/go:/home/biffen/src/go:/home/biffen/src/private/go"
GOPRIVATE="███"
GOPROXY="direct"
GOROOT="/usr/local/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.3"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/biffen/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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build735231424=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I came across an internal compiler error while testing a project. First locally then in CI/CD (self-hosted GitLab running a golang Docker container).

I removed enough code to produce this:

package main

import (
	"fmt"

	"github.com/doug-martin/goqu/v9"
	"github.com/doug-martin/goqu/v9/exp"
)

type Cols []exp.Expression

func main() {
	columns := struct {
		Foo exp.IdentifierExpression
		Bar exp.IdentifierExpression
		Baz exp.IdentifierExpression
	}{
		Foo: goqu.I("foo"),
		Bar: goqu.I("bar"),
		Baz: goqu.I("baz"),
	}

	_ = [...]struct {
		Columns Cols
	}{
		{
			Columns: Cols{columns.Bar},
		},
		{
			Columns: Cols{columns.Bar},
		},
		{
			Columns: Cols{columns.Bar},
		},
		{
			Columns: Cols{columns.Baz, columns.Foo},
		},
		{
			Columns: Cols{columns.Baz, columns.Foo},
		},
	}

	fmt.Println("done")
}

With the above code in test.go I ran go run ./test.go.

(Strangely, the same code seems to work on go.dev/play: https://go.dev/play/p/A-TOmDsk13O)

What did you expect to see?

done and a 0 exit code.

What did you see instead?

$ go run ./test.go 
# command-line-arguments
./test.go:27:25: internal compiler error: missing typecheck: 
.   AS # test.go:27:25
.   .   NAME-main..autotmp_21 esc(N) Class:PAUTO Offset:0 AutoTemp OnStack Used exp.IdentifierExpression tc(1) # test.go:27:25
.   .   DOT main.Bar exp.IdentifierExpression tc(1) # test.go:27:25
.   .   .   NAME-main.columns esc(no) Class:PAUTO Offset:0 OnStack Used STRUCT-struct { Foo exp.IdentifierExpression; Bar exp.IdentifierExpression; Baz exp.IdentifierExpression } tc(1) # test.go:13:2

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

Metadata

Metadata

Assignees

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