summaryrefslogtreecommitdiffstats
path: root/src/cmd/compile/internal/ssa/testdata/i22558.go
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:25:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:25:22 +0000
commitf6ad4dcef54c5ce997a4bad5a6d86de229015700 (patch)
tree7cfa4e31ace5c2bd95c72b154d15af494b2bcbef /src/cmd/compile/internal/ssa/testdata/i22558.go
parentInitial commit. (diff)
downloadgolang-1.22-f6ad4dcef54c5ce997a4bad5a6d86de229015700.tar.xz
golang-1.22-f6ad4dcef54c5ce997a4bad5a6d86de229015700.zip
Adding upstream version 1.22.1.upstream/1.22.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/testdata/i22558.go')
-rw-r--r--src/cmd/compile/internal/ssa/testdata/i22558.go51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/testdata/i22558.go b/src/cmd/compile/internal/ssa/testdata/i22558.go
new file mode 100644
index 0000000..8aea76c
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/i22558.go
@@ -0,0 +1,51 @@
+package main
+
+import (
+ "fmt"
+ "os"
+)
+
+type big struct {
+ pile [768]int8
+}
+
+type thing struct {
+ name string
+ next *thing
+ self *thing
+ stuff []big
+}
+
+func test(t *thing, u *thing) {
+ if t.next != nil {
+ return
+ }
+ fmt.Fprintf(os.Stderr, "%s\n", t.name)
+ u.self = u
+ t.self = t
+ t.next = u
+ for _, p := range t.stuff {
+ if isFoo(t, p) {
+ return
+ }
+ }
+}
+
+//go:noinline
+func isFoo(t *thing, b big) bool {
+ return true
+}
+
+func main() {
+ growstack() // Use stack early to prevent growth during test, which confuses gdb
+ t := &thing{name: "t", self: nil, next: nil, stuff: make([]big, 1)}
+ u := thing{name: "u", self: t, next: t, stuff: make([]big, 1)}
+ test(t, &u)
+}
+
+var snk string
+
+//go:noinline
+func growstack() {
+ snk = fmt.Sprintf("%#v,%#v,%#v", 1, true, "cat")
+}