Skip to content

cmd/compile: loop induction with * and << induction operators #78377

Description

@Jorropo
go version go1.27-devel_a6500456f3 Wed Mar 25 22:41:27 2026 -0700 linux/amd64

See the following minimal repro:

package p

func f(s []byte) {
    for i := uint(1); i < uint(len(s)); i *= 2 {
        _ = s[i]
    }
}

This generate a bounds check even tho we don't need to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone 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.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions