// To identify variables by original source position.
type varPos struct {
+ DeclName string
DeclFile string
DeclLine uint
DeclCol uint
n := dcl[i]
pos := Ctxt.InnermostPos(n.Pos)
vp := varPos{
+ DeclName: n.Sym.Name,
DeclFile: pos.Base().SymFilename(),
DeclLine: pos.Line(),
DeclCol: pos.Col(),
}
+ if _, found := m[vp]; found {
+ Fatalf("child dcl collision on symbol %s within %v\n", n.Sym.Name, fnsym.Name)
+ }
m[vp] = i
}
for j := 0; j < len(sl); j++ {
vp := varPos{
+ DeclName: sl[j].Name,
DeclFile: sl[j].DeclFile,
DeclLine: sl[j].DeclLine,
DeclCol: sl[j].DeclCol,
var G int
+func noinline(x int) int {
+ defer func() { G += x }()
+ return x
+}
+
func cand(x, y int) int {
- return (x + y) ^ (y - x)
+ return noinline(x+y) ^ (y - x)
}
func main() {
}
}
exCount++
+
+ omap := make(map[dwarf.Offset]bool)
+
+ // Walk the child variables of the inlined routine. Each
+ // of them should have a distinct abstract origin-- if two
+ // vars point to the same origin things are definitely broken.
+ inlIdx := ex.idxFromOffset(child.Offset)
+ inlChildDies := ex.Children(inlIdx)
+ for _, k := range inlChildDies {
+ ooff, originOK := k.Val(dwarf.AttrAbstractOrigin).(dwarf.Offset)
+ if !originOK {
+ t.Fatalf("no abstract origin attr for child of inlined subroutine at offset %v", k.Offset)
+ }
+ if _, found := omap[ooff]; found {
+ t.Fatalf("duplicate abstract origin at child of inlined subroutine at offset %v", k.Offset)
+ }
+ omap[ooff] = true
+ }
}
}
if exCount != len(expectedInl) {