aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2013-09-17 22:11:43 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-09-17 22:11:43 +0000
commitb15d794389aaf8d87e53549aea1e171a5deaad78 (patch)
tree6990912d681eeeada6a993bf6923d62a5add528d /libgo
parent09d5094b2d48192f5e4cc7be9b123289c41a8f65 (diff)
downloadgcc-b15d794389aaf8d87e53549aea1e171a5deaad78.zip
gcc-b15d794389aaf8d87e53549aea1e171a5deaad78.tar.gz
gcc-b15d794389aaf8d87e53549aea1e171a5deaad78.tar.bz2
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
Diffstat (limited to 'libgo')
-rw-r--r--libgo/go/reflect/value.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/libgo/go/reflect/value.go b/libgo/go/reflect/value.go
index 45a0858..69a8703 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
}