Skip to content

cmd/compile: Go 1.22 build fails with 1.21 PGO profile on internal/saferio change #65615

Closed
@konradreiche

Description

@konradreiche

Go version

go version go1.22.0 linux/amd64

Output of go env in your module/workspace:

GOARCH='amd64'
GOOS='linux'
GOVERSION='go1.22.0'

What did you do?

We are continuously collecting PGO profiles and apply them to new builds, a process that worked seamlessly with Go 1.21. I upgraded to Go 1.22 and attempted to compile our build using the Go 1.21 PGO profile.

go build -pgo=auto .

What did you see happen?

The go build command failed, producing the following error:

go build -pgo=auto .
# encoding/gob
/usr/lib/go/src/bufio/bufio.go:47:6: internal compiler error: saferio.SliceCap has 0+1 params, but instantiated with 0+0 args

This error suggests a change made to the SliceCap method in the internal/saferio package between Go 1.21 and Go 1.22:

https://github.com/golang/go/blob/release-branch.go1.21/src/internal/saferio/io.go#L116
https://github.com/golang/go/blob/release-branch.go1.22/src/internal/saferio/io.go#L128

The build compiles successfully with PGO turned off:

go build -pgo=off .

What did you expect to see?

Expected the go build command to compile the build successfully, as it did with Go 1.21.

Metadata

Metadata

Assignees

Labels

NeedsFixThe 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