]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/dwarfgen: make scope test less sensitive to changes in escape...
authorthepudds <thepudds1460@gmail.com>
Thu, 31 Aug 2023 14:16:01 +0000 (10:16 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 7 Sep 2023 00:29:59 +0000 (00:29 +0000)
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>
src/cmd/compile/internal/dwarfgen/scope_test.go

index ae4a87c52a2828b44095c38151ab034e6d8d9f65..ee4170ef44fe1101a7ca58d3fc1de1a18395cc29 100644 (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"},