summaryrefslogtreecommitdiff
path: root/test/fixedbugs/issue48097.go
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2021-09-01 10:13:41 +0700
committerCuong Manh Le <cuong.manhle.vn@gmail.com>2021-09-01 19:51:25 +0000
commit711e1c8224f033ec1d95cdf84465b57b052e8948 (patch)
tree10bd5da46407428a05ceb1c4e7d654e6380f522e /test/fixedbugs/issue48097.go
parent592ee433f5378e4b08f1fd8860be61b9bf20ca19 (diff)
downloadgo-git-711e1c8224f033ec1d95cdf84465b57b052e8948.tar.gz
cmd/compile: fix irgen mis-handling invalid function declaration
In -G=3 mode, irgen use its own generated IR, which is mis-handling of bodyless function and declared function with //go:noescape pragma. Fix this by adopting the same logic in noder.funcDecl, which minor change in linkname detection. Fixes #48097 Change-Id: Ibef921c1f75e071ca61685e0cb4543f2ee5efc7f Reviewed-on: https://go-review.googlesource.com/c/go/+/346470 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: Cherry Mui <cherryyz@google.com> Reviewed-by: Dan Scales <danscales@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'test/fixedbugs/issue48097.go')
-rw-r--r--test/fixedbugs/issue48097.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/fixedbugs/issue48097.go b/test/fixedbugs/issue48097.go
new file mode 100644
index 0000000000..b08c2a2f52
--- /dev/null
+++ b/test/fixedbugs/issue48097.go
@@ -0,0 +1,12 @@
+// errorcheck -complete
+
+// 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() // ERROR "missing function body"
+
+//go:noescape
+func f() {} // ERROR "can only use //go:noescape with external func implementations"