aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2021-05-05 09:23:52 +0700
committerCuong Manh Le <cuong.manhle.vn@gmail.com>2021-05-05 18:03:32 +0000
commit95dde3f0290b0df797770afc899ae977ed89833e (patch)
tree3e299507c3a804929bfaf6adf81e257418b66aad /test
parentd0583b131a1c4c99249aa1b158492cd99d7ee904 (diff)
downloadgo-95dde3f0290b0df797770afc899ae977ed89833e.tar.gz
go-95dde3f0290b0df797770afc899ae977ed89833e.zip
cmd/compile: do not substitute OGOTO inside a closure when inlining
The inlsubst already does the same thing for OLABEL, so we must do the same thing for OGOTO. Otherwise, new inlined OGOTO node will be associated with non-existed label. Fixes #45947 Change-Id: I40eef095f57fd3438c38a0b5d9751d5d7ebf759e Reviewed-on: https://go-review.googlesource.com/c/go/+/316931 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'test')
-rw-r--r--test/fixedbugs/issue45947.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/fixedbugs/issue45947.go b/test/fixedbugs/issue45947.go
new file mode 100644
index 00000000000..40864493403
--- /dev/null
+++ b/test/fixedbugs/issue45947.go
@@ -0,0 +1,16 @@
+// compile
+
+// Copyright 2021 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
+
+func f() {
+ _ = func() func() {
+ return func() {
+ l:
+ goto l
+ }
+ }()
+}