Go version

go version go1.22.0 darwin/amd64

Output of go env in your module/workspace:

GO111MODULE='on'
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/fabianr/Library/Caches/go-build'
GOENV='/Users/fabianr/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT='rangefunc'
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/fabianr/e/be/gohome/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/fabianr/e/be/gohome'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.22.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/fabianr/go/src/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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/5y/2cd0ydxn7nl7sz2nnk3d91xc0000gn/T/go-build3586506670=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

This playground code.

What did you see happen?

I would expect it to compile (it does in Go 1.21).

What did you expect to see?

It does not:

<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

Go build failed.

Comment From: cuonglm

git bisect points to https://go-review.googlesource.com/c/go/+/507295

cc @dr2chase

Comment From: gopherbot

Change https://go.dev/cl/568258 mentions this issue: cmd/compile: add 0-sized-value simplification to copyelim

Comment From: dr2chase

@gopherbot please consider this for backport to 1.22; it is likely a regression from the expand_calls cleanup.

I tested the backport already, the fix is targeted, low risk, and applies clean.

Comment From: gopherbot

Backport issue(s) opened: #68594 (for 1.22).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.