aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2021-05-04 16:18:56 -0400
committerThan McIntosh <thanm@google.com>2021-05-05 01:47:58 +0000
commit66ce8aa88d144338868b0d3ab8c895608a460750 (patch)
tree903f4f6119631b072a83fc71ecaa2fbf74c1d0e9 /src/cmd
parent4df662fb373480b5055e645120558bb536fae42c (diff)
downloadgo-66ce8aa88d144338868b0d3ab8c895608a460750.tar.gz
go-66ce8aa88d144338868b0d3ab8c895608a460750.zip
cmd/compile: handle degenerate entry blocks in -N debug gen
The code that created DWARF debug var locations for input parameters in the non-optimized case for regabi was not doing the right thing for degenerate functions with infinite loops. Detect these cases and don't try to emit the normal location data. Fixes #45948. Change-Id: I2717fc4bac2e03d5d850a6ec8a09ed05fed0c896 Reviewed-on: https://go-review.googlesource.com/c/go/+/316752 Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/compile/internal/ssa/debug.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/ssa/debug.go b/src/cmd/compile/internal/ssa/debug.go
index ee522f41ef..2f379c9e2c 100644
--- a/src/cmd/compile/internal/ssa/debug.go
+++ b/src/cmd/compile/internal/ssa/debug.go
@@ -1362,9 +1362,6 @@ func BuildFuncDebugNoOptimized(ctxt *obj.Link, f *Func, loggingEnabled bool, sta
// 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
@@ -1381,6 +1378,15 @@ func BuildFuncDebugNoOptimized(ctxt *obj.Link, f *Func, loggingEnabled bool, sta
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.