Skip to content

cmd/compile: more incorrect loop variable detection #53663

@randall77

Description

@randall77

This program should terminate after one iteration. Instead, it runs forever.

Related to #53600 #53653

package main

import "math"

//go:noinline
func f(i int64) {
	for j := int64(math.MaxInt64); j <= i-1; j++ {
		if j < 0 {
			break
		}
		println(j)
	}
}

func main() {
	f(math.MinInt64)
}

@dr2chase @rasky

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions