From b15d794389aaf8d87e53549aea1e171a5deaad78 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 17 Sep 2013 22:11:43 +0000 Subject: [PATCH] reflect: Fix bug calling method on indirect value. The gccgo-specific iword function was checking v.kind, but for a method value that is always Func. Fix to check v.typ.Kind() instead. From-SVN: r202670 --- libgo/go/reflect/value.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libgo/go/reflect/value.go b/libgo/go/reflect/value.go index 45a08587973..69a87031e56 100644 --- a/libgo/go/reflect/value.go +++ b/libgo/go/reflect/value.go @@ -611,7 +611,13 @@ func methodReceiver(op string, v Value, methodIndex int) (t *rtype, fn unsafe.Po } fn = unsafe.Pointer(&m.tfn) t = m.mtyp - rcvr = v.iword() + // Can't call iword here, because it checks v.kind, + // and that is always Func. + if v.flag&flagIndir != 0 && (v.typ.Kind() == Ptr || v.typ.Kind() == UnsafePointer) { + rcvr = loadIword(v.val, v.typ.size) + } else { + rcvr = iword(v.val) + } } return }