go i22558 源码

  • 2022-07-15
  • 浏览 (1213)

golang i22558 代码

文件路径:/src/cmd/compile/internal/ssa/testdata/i22558.go

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")
}

相关信息

go 源码目录

相关文章

go convertline 源码

go hist 源码

go i22600 源码

go infloop 源码

go inline-dump 源码

go pushback 源码

go sayhi 源码

go scopes 源码

0  赞