Skip to content

cmd/compile: internal compiler error: 'foo.toStrings': value v2 still has 1 uses #68585

@PPYSC

Description

@PPYSC

Go version

go version go1.22.5 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/root/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/root/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/bigdata/qiuhan/go1.22.5'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/bigdata/qiuhan/go1.22.5/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.5'
GCCGO='/usr/bin/gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/bigdata/qiuhan/difftest/20240725_test_unit/d_2055/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build389564710=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Compile using the command go build main.go.

https://go.dev/play/p/EkHQBeM63VJ

package main

type Stringer interface {
	String() string
}

type (
	stringer  struct{}
	stringers [2]stringer
	foo       struct {
		stringers
	}
)

func (stringer) String() string  { return "" }
func toString(s Stringer) string { return s.String() }

func (v stringers) toStrings() []string {
	return []string{toString(v[0]), toString(v[1])}
}

func main() {
	_ = stringers{}
}

What did you see happen?

An internal compiler error occurred.

$ go build main.go
# 2055
<autogenerated>:1: internal compiler error: 'foo.toStrings': value v2 still has 1 uses

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

What did you expect to see?

Successful compilation of the program.

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.gabywins

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions