1
0
mirror of https://github.com/golang/go synced 2024-11-22 10:54:46 -07:00
go/test/fixedbugs/issue68809.go
Keith Randall f259e4c916 cmd/compile: fix off-by-one error in prove pass
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>
2024-08-09 20:14:40 +00:00

20 lines
300 B
Go

// 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")
}
}