diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-17 22:11:43 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-17 22:11:43 +0000 |
commit | dee8f872534d1b9d5d3e352515301574bfd6ff17 (patch) | |
tree | 6990912d681eeeada6a993bf6923d62a5add528d /libgo | |
parent | 55ea1438d5b3b0eb3ed32da0017ded6ebf0e3480 (diff) | |
download | gcc-dee8f872534d1b9d5d3e352515301574bfd6ff17.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202670 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/go/reflect/value.go | 8 |
1 files changed, 7 insertions, 1 deletions
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 } |