You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func main() {
for i := math.MinInt64 + 2; i >= math.MinInt64; i-- {
if i == math.MaxInt64 {
break
}
println(i)
}
}
This program will loop forever when it shouldn't. You can "fix" it by passing -gcflags=-N.
Similar to #53600, this is a bug in induction variable detection. Just reversing the direction when step is negative in cmd/compile/internal/ssa/loopbce.go (added in CL 104041 ) isn't quite right. The "distance until overflow" isn't preserved under mirroring.
Activity
gopherbot commentedon Jul 2, 2022
Change https://go.dev/cl/415854 mentions this issue:
cmd/compile: fix prove pass when lower condition is >= minintgopherbot commentedon Jul 2, 2022
Change https://go.dev/cl/415874 mentions this issue:
cmd/compile: rework induction variable detectorcmd/compile: rework induction variable detector
cmd/compile: rework induction variable detector