I think I introduced #68809 when rewriting the prove pass, by
introducing an off-by-one error here:
https://go-review.googlesource.com/c/go/+/599096/5/src/cmd/compile/internal/ssa/prove.go
lines 872-874.
The min++ is already handled in one of the two following cases with
the (r&eq==0) condition. Move the min++ to just the other case.
Fixes #68809
Change-Id: Iffae99e29219c94aaf584cd7ae247289fa604a00
Reviewed-on: https://go-review.googlesource.com/c/go/+/604100
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
// We know that either x>min OR x<=max. factsTable cannot record OR conditions,
// so let's see if we can already prove that one of them is false, in which case
// the other must be true
- if r == gt {
- min++
- }
l := ft.limits[x.ID]
if l.max <= min {
if r&eq == 0 || l.max < min {
}
} else if l.min > max {
// x<=max is impossible, so it must be x>min
+ if r == gt {
+ min++
+ }
ft.signedMin(x, min)
}
}
--- /dev/null
+// run
+
+// Copyright 2024 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+func main() {
+ cnt := 0
+ for i := 1; i <= 11; i++ {
+ if i-6 > 4 {
+ cnt++
+ }
+ }
+ if cnt != 1 {
+ panic("bad")
+ }
+}