aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-08-21 12:40:25 -0700
committerIan Lance Taylor <iant@golang.org>2021-08-25 03:12:43 +0000
commitd37b8dedf7f96d88c7280f6afadb09b100380f93 (patch)
treeab919874eec3264d11c931924d7631ebd853d0ea /test
parent41b99dab0f263bd3fe5c2592f1c40735dcaa016a (diff)
downloadgo-d37b8dedf7f96d88c7280f6afadb09b100380f93.tar.gz
go-d37b8dedf7f96d88c7280f6afadb09b100380f93.zip
test: add test case that gofrontend miscompiled
For #47771 Change-Id: I99dfdd48def756bde68445b50741afd6d86b6cf2 Reviewed-on: https://go-review.googlesource.com/c/go/+/344169 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'test')
-rw-r--r--test/fixedbugs/issue47771.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/fixedbugs/issue47771.go b/test/fixedbugs/issue47771.go
new file mode 100644
index 0000000000..a434bffe4b
--- /dev/null
+++ b/test/fixedbugs/issue47771.go
@@ -0,0 +1,19 @@
+// run
+
+// 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.
+
+// gofrontend miscompiled some cases of append(s, make(typ, ln)...).
+
+package main
+
+var g int
+
+func main() {
+ a := []*int{&g, &g, &g, &g}
+ a = append(a[:0], make([]*int, len(a) - 1)...)
+ if len(a) != 3 || a[0] != nil || a[1] != nil || a[2] != nil {
+ panic(a)
+ }
+}