Skip to content

Commit 9f5298c

Browse files
committed
cmd/compile: fix confusion in generating SelectN index
Old: return the ABI register index of the result (wrong!) New: return the index w/in sequence of result registers (right!) Fixed bug: genCaller0/genCaller0.go:43:9: internal compiler error: 'Caller0': panic during schedule while compiling Caller0: runtime error: index out of range [10] with length 9 Updates #44816. Change-Id: I1111e283658a2d6422986ae3d61bd95d1b9bde5e Reviewed-on: https://go-review.googlesource.com/c/go/+/299549 Trust: David Chase <drchase@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
1 parent 98dfdc8 commit 9f5298c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cmd/compile/internal/ssa/expand_calls.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,11 @@ func (x *expandState) rewriteSelect(leaf *Value, selector *Value, offset int64,
424424
}
425425
outParam := aux.abiInfo.OutParam(int(which))
426426
if len(outParam.Registers) > 0 {
427-
reg := int64(outParam.Registers[regOffset])
427+
firstReg := uint32(0)
428+
for i := 0; i < int(which); i++ {
429+
firstReg += uint32(len(aux.abiInfo.OutParam(i).Registers))
430+
}
431+
reg := int64(regOffset + Abi1RO(firstReg))
428432
if leaf.Block == call.Block {
429433
leaf.reset(OpSelectN)
430434
leaf.SetArgs1(call0)

0 commit comments

Comments
 (0)