ODOTMETH,
// treat recv.meth as a value with recv in it, only happens in ODEFER and OPROC
// iface.method already leaks iface in esccall, no need to put in extra ODOTINTER edge here
- ODOTTYPE2,
OSLICE,
OSLICE3,
OSLICEARR,
// Conversions, field access, slice all preserve the input value.
escassign(e, dst, src.Left, e.stepAssign(step, originalDst, src, dstwhy))
- case ODOTTYPE:
+ case ODOTTYPE,
+ ODOTTYPE2:
if src.Type != nil && !haspointers(src.Type) {
break
}
}
}
-func dotTypeEscape2() { // #13805
+func dotTypeEscape2() { // #13805, #15796
{
i := 0
+ j := 0
var v int
+ var ok bool
var x interface{} = i // ERROR "i does not escape"
+ var y interface{} = j // ERROR "j does not escape"
+
*(&v) = x.(int) // ERROR "&v does not escape"
+ *(&v), *(&ok) = y.(int) // ERROR "&v does not escape" "&ok does not escape"
}
{
i := 0
+ j := 0
+ var ok bool
var x interface{} = i // ERROR "i does not escape"
- sink = x.(int) // ERROR "x.\(int\) escapes to heap"
+ var y interface{} = j // ERROR "j does not escape"
+ sink = x.(int) // ERROR "x.\(int\) escapes to heap"
+ sink, *(&ok) = y.(int) // ERROR "&ok does not escape"
}
{
i := 0 // ERROR "moved to heap: i"
+ j := 0 // ERROR "moved to heap: j"
+ var ok bool
var x interface{} = &i // ERROR "&i escapes to heap"
+ var y interface{} = &j // ERROR "&j escapes to heap"
+
sink = x.(*int) // ERROR "x.\(\*int\) escapes to heap"
+ sink, *(&ok) = y.(*int) // ERROR "&ok does not escape"
}
}