OSDN Git Service

reflect: Fix invalid sharing in valueInterface.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 19 Nov 2012 05:33:54 +0000 (05:33 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 19 Nov 2012 05:33:54 +0000 (05:33 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@193613 138bc75d-0d04-0410-961f-82ee72b054a4

libgo/go/reflect/value.go

index b25e5c7..5d08900 100644 (file)
@@ -841,7 +841,7 @@ func valueInterface(v Value, safe bool) interface{} {
        eface.typ = v.typ.runtimeType()
        eface.word = v.iword()
 
-       if v.flag&flagIndir != 0 && v.typ.size > ptrSize {
+       if v.flag&flagIndir != 0 && v.kind() != Ptr && v.kind() != UnsafePointer {
                // eface.word is a pointer to the actual data,
                // which might be changed.  We need to return
                // a pointer to unchanging data, so make a copy.