mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: fix loong64 constant folding in division rules
The divisor must be non-zero for the rule to be triggered. Fixes #53018 Change-Id: Id56b8d986945bbb66e13131d11264ee438de5cb2 Reviewed-on: https://go-review.googlesource.com/c/go/+/407655 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: xiaodong liu <teaofmoli@gmail.com> Reviewed-by: WANG Xuerui <git@xen0n.name>
This commit is contained in:
parent
2138124143
commit
a2bca290e7
3 changed files with 50 additions and 4 deletions
30
test/fixedbugs/issue53018.go
Normal file
30
test/fixedbugs/issue53018.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// compile
|
||||
|
||||
// Copyright 2022 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 p
|
||||
|
||||
var V []int
|
||||
|
||||
func f(i int, c chan int) int {
|
||||
arr := []int{0, 1}
|
||||
for range c {
|
||||
for a2 := range arr {
|
||||
var a []int
|
||||
V = V[:1/a2]
|
||||
a[i] = 0
|
||||
}
|
||||
return func() int {
|
||||
arr = []int{}
|
||||
return func() int {
|
||||
return func() int {
|
||||
return func() int { return 4 }()
|
||||
}()
|
||||
}()
|
||||
}()
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue