From: Austin Clements Date: Tue, 22 May 2018 21:27:54 +0000 (-0400) Subject: cmd/compile: ignore g register in liveness analysis X-Git-Tag: go1.11beta1~345 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=132900982c2b28470559afcdc43f517cdf285e9c;p=gostls13.git cmd/compile: ignore g register in liveness analysis In rare circumstances that we don't yet fully understand, the g register can be spilled to the stack and then reloaded. If this happens, liveness analysis sees a pointer load into a non-general-purpose register and panics. We should fix the root cause of this, but fix the build for now by ignoring pointer loads into the g register. For #25504. Change-Id: I0dfee1af9750c8e9157c7637280cdf07118ef2ca Reviewed-on: https://go-review.googlesource.com/114081 Run-TryBot: Austin Clements Reviewed-by: Keith Randall TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/compile/internal/gc/plive.go b/src/cmd/compile/internal/gc/plive.go index 4d5e6ff560..28541870a2 100644 --- a/src/cmd/compile/internal/gc/plive.go +++ b/src/cmd/compile/internal/gc/plive.go @@ -461,6 +461,17 @@ func (lv *Liveness) regEffects(v *ssa.Value) (uevar, kill liveRegMask) { for _, reg := range regs[:nreg] { if reg.GCNum() == -1 { if ptrOnly { + if reg.String() == "g" { + // Issue #25504: Sometimes we + // spill and reload the g + // register, which this sees + // as a pointer load into the + // g register. The g register + // isn't a GP register and + // can't appear in register + // maps. Ignore it. + continue + } v.Fatalf("pointer in non-pointer register %v", reg) } else { continue