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.
Induction variable detection is still not quite right. I've added
another failing test.
Redo the overflow/underflow detector so it is more obviously correct.
Update golang#53600Fixesgolang#53653Fixesgolang#53663
Change-Id: Id95228e282fdbf6bd80b26e1c41d62e935ba08ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/415874
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: David Chase <drchase@google.com>
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 incmd/compile/internal/ssa/loopbce.go
(added in CL 104041 ) isn't quite right. The "distance until overflow" isn't preserved under mirroring.@dr2chase @rasky
The text was updated successfully, but these errors were encountered: