Skip to content

cmd/compile: regression in writebarrier pass #19179

@dsnet

Description

@dsnet

c4ef597 caused a regression where the following coder no longer compiles:

type Foo struct{ A, B time.Duration }

func Bar(fs []Foo) string {
	ss := make([]string, 2*len(fs))
	for i, h := range fs {
		ss[2*i] = fmt.Sprintf("%v %v", h.A, h.B.Seconds())
		ss[2*i+1] = fmt.Sprintf("%v %v", h.A, h.B.Seconds())
	}
	return strings.Join(ss, ",")
}

It now panics with:

./main.go:16: internal compiler error: attempt to load unspilled value v53 = MOVQload <time.Duration> {h} [8] v2 v117

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
	/home/rawr/Projects/go/src/runtime/debug/stack.go:24 +0x79
cmd/compile/internal/gc.Fatalf(0xaccaeb, 0x22, 0xc4204a4600, 0x1, 0x1)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/subr.go:175 +0x230
cmd/compile/internal/gc.(*ssaExport).Fatalf(0xdd0af5, 0x100d00000001, 0xaccaeb, 0x22, 0xc4204a4600, 0x1, 0x1)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:4929 +0x67
cmd/compile/internal/ssa.(*Config).Fatalf(0xc420452000, 0x100d00000001, 0xaccaeb, 0x22, 0xc4204a4600, 0x1, 0x1)
	/home/rawr/Projects/go/src/cmd/compile/internal/ssa/config.go:345 +0x76
cmd/compile/internal/ssa.(*Func).Fatalf(0xc4204b4000, 0xaccaeb, 0x22, 0xc4204a4600, 0x1, 0x1)
	/home/rawr/Projects/go/src/cmd/compile/internal/ssa/func.go:416 +0x72
cmd/compile/internal/ssa.(*regAllocState).allocValToReg(0xc4204d83c0, 0xc420453988, 0xffce, 0x100000001, 0xc400001233, 0xc4204551e8)
	/home/rawr/Projects/go/src/cmd/compile/internal/ssa/regalloc.go:454 +0x58e
cmd/compile/internal/ssa.(*regAllocState).regalloc(0xc4204d83c0, 0xc4204b4000)
	/home/rawr/Projects/go/src/cmd/compile/internal/ssa/regalloc.go:1188 +0x1731
cmd/compile/internal/ssa.regalloc(0xc4204b4000)
	/home/rawr/Projects/go/src/cmd/compile/internal/ssa/regalloc.go:135 +0x62
cmd/compile/internal/ssa.Compile(0xc4204b4000)
	/home/rawr/Projects/go/src/cmd/compile/internal/ssa/compile.go:70 +0x2c4
cmd/compile/internal/gc.buildssa(0xc4200b9180, 0x0)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:173 +0x1060
cmd/compile/internal/gc.compile(0xc4200b9180)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/pgen.go:366 +0x2d0
cmd/compile/internal/gc.funccompile(0xc4200b9180)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/dcl.go:1226 +0xdc
cmd/compile/internal/gc.Main()
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/main.go:473 +0x202d
main.main()
	/home/rawr/Projects/go/src/cmd/compile/main.go:50 +0x101

\cc @cherrymui @dr2chase @josharian

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions