Skip to content

Commit 456eaf5

Browse files
Jorropoprattmic
authored andcommitted
[release-branch.go1.24] cmd/compile: don't report newLimit discovered when unsat happens multiple times
Fixes #71855 Change-Id: I696fcb8fc8c0c2e5e5ae6ab50596f6bdb9b7d498 Reviewed-on: https://go-review.googlesource.com/c/go/+/650975 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> Reviewed-by: Keith Randall <[email protected]> (cherry picked from commit 00635de) Reviewed-on: https://go-review.googlesource.com/c/go/+/652179 Reviewed-by: Jorropo <[email protected]> Reviewed-by: Michael Pratt <[email protected]>
1 parent e4ef833 commit 456eaf5

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/cmd/compile/internal/ssa/prove.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,9 @@ func (ft *factsTable) newLimit(v *Value, newLim limit) bool {
552552
}
553553

554554
if lim.unsat() {
555+
r := !ft.unsat
555556
ft.unsat = true
556-
return true
557+
return r
557558
}
558559

559560
// Check for recursion. This normally happens because in unsatisfiable

test/fixedbugs/issue71852.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// compile
2+
3+
// Copyright 2025 The Go Authors. All rights reserved.
4+
// Use of this source code is governed by a BSD-style
5+
// license that can be found in the LICENSE file.
6+
7+
package main
8+
9+
import (
10+
"math"
11+
)
12+
13+
func main() {
14+
test(2)
15+
}
16+
17+
func test(i int) {
18+
if i <= 0 {
19+
return
20+
}
21+
22+
_ = math.Pow10(i + 2)
23+
}

0 commit comments

Comments
 (0)