1
0
mirror of https://github.com/golang/go synced 2024-11-24 14:10:03 -07:00
go/test/fixedbugs/issue40367.go
Cholerae Hu 7f86080476 cmd/compile: don't addLocalInductiveFacts if there is no direct edge from if block to phi block
Currently in addLocalInductiveFacts, we only check whether
direct edge from if block to phi block exists. If not, the
following logic will treat the phi block as the first successor,
which is wrong.

This patch makes prove pass more conservative, so we disable
some cases in test/prove.go. We will do some optimization in
the following CL and enable these cases then.

Fixes #40367.

Change-Id: I27cf0248f3a82312a6f7dabe11c79a1a34cf5412
Reviewed-on: https://go-review.googlesource.com/c/go/+/244579
Reviewed-by: Zach Jones <zachj1@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-07-30 17:23:11 +00:00

41 lines
526 B
Go

// run
// Copyright 2020 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 case1() {
rates := []int32{1,2,3,4,5,6}
var sink [6]int
j := len(sink)
for star, _ := range rates {
if star+1 < 1 {
panic("")
}
j--
sink[j] = j
}
}
func case2() {
i := 0
var sink [3]int
j := len(sink)
top:
j--
sink[j] = j
if i < 2 {
i++
if i < 1 {
return
}
goto top
}
}
func main() {
case1()
case2()
}