- Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
Go version
go1.26-devel_b0f75c6bd1
Output of go env in your module/workspace:
AR='ar' CC='clang' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_ENABLED='1' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' CXX='clang++' GCCGO='gccgo' GO111MODULE='' GOARCH='arm64' GOARM64='v8.0' GOAUTH='netrc' GOBIN='' GOCACHE='/Users/drchase/Library/Caches/go-build' GOCACHEPROG='' GODEBUG='' GOENV='/Users/drchase/Library/Application Support/go/env' GOEXE='' GOEXPERIMENT='' GOFIPS140='off' GOFLAGS='' GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/vl/jd15hgb540x9qrp01g6896pc0095tn/T/go-build198174780=/tmp/go-build -gno-record-gcc-switches -fno-common' GOHOSTARCH='arm64' GOHOSTOS='darwin' GOINSECURE='' GOMOD='/dev/null' GOMODCACHE='/Users/drchase/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='darwin' GOPATH='/Users/drchase/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/Users/drchase/work/go' GOSUMDB='sum.golang.org' GOTELEMETRY='local' GOTELEMETRYDIR='/Users/drchase/Library/Application Support/go/telemetry' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/Users/drchase/work/go/pkg/tool/darwin_arm64' GOVCS='' GOVERSION='go1.26-devel_b0f75c6bd1 Tue Nov 11 16:09:30 2025 -0500' GOWORK='' PKG_CONFIG='pkg-config'What did you do?
foo.go:
package foo func f(a, b []byte) byte { lenA := len(a) lenB := len(b) idxA := lenA - 1 idxB := lenB - 1 c := byte(0) for idxA >= 0 && idxB >= 0 { c ^= a[idxA] // random op c ^= b[idxB] // random op idxA-- idxB-- } return c } and commands plus output:
GOSSAFUNC=f go build -gcflags=-d=ssa/prove/debug=1 foo.go # command-line-arguments dumped SSA for f,1 to ./ssa.html ./foo.go:11:16: Induction variable: limits [0,?], increment 1 ./foo.go:12:9: Proved IsInBounds What did you see happen?
I notice one bounds check removal, and examining the generated code in ssa.html, saw that there was still a bounds check remaining (i.e., there were two, one was removed, the other remained).
What did you expect to see?
Two bounds checks removed, none remaining.
This seemed "obvious" but of course I know it is not, but it is a deficiency and if we/someone can figure out what went wrong here and fix it, then number go up.
Jorropo
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
Status
Todo