1
0
mirror of https://github.com/golang/go synced 2024-11-23 08:50:03 -07:00

cmd/compile/internal/dwarfgen: make scope test less sensitive to changes in escape analysis

The test function fi is used in TestEscape, and the intent of fi
seems to be to leak its argument, but fi is currently
sensitive to changes in escape analysis regarding interface receivers.

Make fi less sensitive by directly leaking its argument.

Change-Id: I16cc3d3a6bd7b08a08c8fc292b0b99c9a54d68d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/524943
Run-TryBot: t hepudds <thepudds1460@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
thepudds 2023-08-31 10:16:01 -04:00 committed by Gopher Robot
parent 729f214e3a
commit fbaf71f36b

View File

@ -50,13 +50,14 @@ type testline struct {
var testfile = []testline{
{line: "package main"},
{line: "var sink any"},
{line: "func f1(x int) { }"},
{line: "func f2(x int) { }"},
{line: "func f3(x int) { }"},
{line: "func f4(x int) { }"},
{line: "func f5(x int) { }"},
{line: "func f6(x int) { }"},
{line: "func fi(x interface{}) { if a, ok := x.(error); ok { a.Error() } }"},
{line: "func leak(x interface{}) { sink = x }"},
{line: "func gret1() int { return 2 }"},
{line: "func gretbool() bool { return true }"},
{line: "func gret3() (int, int, int) { return 0, 1, 2 }"},
@ -177,7 +178,7 @@ var testfile = []testline{
{line: " b := 2", scopes: []int{1}, vars: []string{"var &b *int", "var p *int"}},
{line: " p := &b", scopes: []int{1}},
{line: " f1(a)", scopes: []int{1}},
{line: " fi(p)", scopes: []int{1}},
{line: " leak(p)", scopes: []int{1}},
{line: " }"},
{line: "}"},
{line: "var fglob func() int"},