// Locate the value corresponding to the last spill of
// an input register.
afterPrologVal := locatePrologEnd(f)
- if afterPrologVal == ID(-1) {
- panic(fmt.Sprintf("internal error: f=%s: can't locate after prolog value", f.Name))
- }
// Walk the input params again and process the register-resident elements.
pidx := 0
slid := len(fd.VarSlots)
fd.VarSlots = append(fd.VarSlots, []SlotID{SlotID(slid)})
+ if afterPrologVal == ID(-1) {
+ // This can happen for degenerate functions with infinite
+ // loops such as that in issue 45948. In such cases, leave
+ // the var/slot set up for the param, but don't try to
+ // emit a location list.
+ pidx++
+ continue
+ }
+
// Param is arriving in one or more registers. We need a 2-element
// location expression for it. First entry in location list
// will correspond to lifetime in input registers.
--- /dev/null
+// compile -N
+
+// 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.
+
+// Issue 45948: assert in debug generation for degenerate
+// function with infinite loop.
+
+package p
+
+func f(p int) {
+L:
+ goto L
+
+}