mirror of
https://github.com/golang/go.git
synced 2025-05-24 17:01:26 +00:00
[dev.ssa] cmd/compile/ssa: add checks for nil args in values
These additional checks were useful in tracking down the broken build (CL 11238). This CL does not fix the build, sadly. Change-Id: I34de3bed223f450aaa97c1cadaba2e4e5850050b Reviewed-on: https://go-review.googlesource.com/11681 Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
66b47812eb
commit
596ddf4368
@ -599,7 +599,11 @@ func (s *state) addr(n *Node) *ssa.Value {
|
|||||||
return s.entryNewValue1A(ssa.OpAddr, Ptrto(n.Type), aux, s.sb)
|
return s.entryNewValue1A(ssa.OpAddr, Ptrto(n.Type), aux, s.sb)
|
||||||
case PPARAM, PPARAMOUT, PAUTO:
|
case PPARAM, PPARAMOUT, PAUTO:
|
||||||
// parameter/result slot or local variable
|
// parameter/result slot or local variable
|
||||||
return s.decladdrs[n]
|
v := s.decladdrs[n]
|
||||||
|
if v == nil {
|
||||||
|
s.Fatalf("addr of undeclared ONAME %v. declared: %v", n, s.decladdrs)
|
||||||
|
}
|
||||||
|
return v
|
||||||
case PAUTO | PHEAP:
|
case PAUTO | PHEAP:
|
||||||
return s.expr(n.Name.Heapaddr)
|
return s.expr(n.Name.Heapaddr)
|
||||||
default:
|
default:
|
||||||
|
@ -92,6 +92,12 @@ func checkFunc(f *Func) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range b.Values {
|
for _, v := range b.Values {
|
||||||
|
for _, arg := range v.Args {
|
||||||
|
if arg == nil {
|
||||||
|
f.Fatalf("value %v has nil arg", v.LongString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if valueMark[v.ID] {
|
if valueMark[v.ID] {
|
||||||
f.Fatalf("value %s appears twice!", v.LongString())
|
f.Fatalf("value %s appears twice!", v.LongString())
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,9 @@ func fprintFunc(w io.Writer, f *Func) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for _, w := range v.Args {
|
for _, w := range v.Args {
|
||||||
if w.Block == b && !printed[w.ID] {
|
// w == nil shouldn't happen, but if it does,
|
||||||
|
// don't panic; we'll get a better diagnosis later.
|
||||||
|
if w != nil && w.Block == b && !printed[w.ID] {
|
||||||
continue outer
|
continue outer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user